Skip to content

Conversation

@Dodecahedr0x
Copy link
Contributor

@Dodecahedr0x Dodecahedr0x commented Dec 4, 2025

Fixes #722

Replaces the transaction executor with a regular RPC to send crank transactions.

Higher dimensional spaghetti as Babur calls it

Summary by CodeRabbit

Release Notes

  • New Features

    • Added network configuration utilities for HTTP and WebSocket URL handling
  • Improvements

    • Enhanced error handling with consistent result types across task scheduler
    • Added timestamps to task tracking for better audit trails
    • Optimized transaction processing via direct RPC integration
  • Chores

    • Removed unused dependencies and legacy test code

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

Manual Deploy Available

You can trigger a manual deploy of this PR branch to testnet:

Deploy to Testnet 🚀

Alternative: Comment /deploy on this PR to trigger deployment directly.

⚠️ Note: Manual deploy requires authorization. Only authorized users can trigger deployments.

Comment updated automatically when the PR is synchronized.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2025

📝 Walkthrough

Walkthrough

The pull request refactors the task scheduler service to use RpcClient for transaction submission instead of a TransactionSchedulerHandle. Key changes include: updating TaskSchedulerService initialization in MagicValidator to accept HTTP config and additional parameters; replacing pubsub-client dependency with rpc-client; simplifying error types by removing Pubsub and task-specific variants; refactoring database methods to return TaskSchedulerResult; replacing internal tx_scheduler field with rpc_client; updating network configuration types with BindAddress methods and introducing Remote and AliasedUrl types; removing integration tests; and adjusting test parameters (commit_frequency_ms to 0).

Assessment against linked issues

Objective Addressed Explanation
Address task scheduler bypassing chainlink to prevent account cloning issues (#722) The PR refactors transaction submission from tx_scheduler to RpcClient, which may facilitate chainlink integration at a higher level, but does not explicitly add chainlink support or demonstrate how missing account cloning is addressed. The changes are structural refactoring rather than explicit chainlink integration.

Out-of-scope changes

Code Change Explanation
Removed integration tests (magicblock-task-scheduler/tests/service.rs) Tests covering schedule_task and cancel_task functionality are deleted without replacement or indication of new test coverage, making it unclear how the refactored service behavior is validated.
Modified commit_frequency_ms from 1_000_000_000 to 0 (test-integration/programs/schedulecommit/src/api.rs) This change to test fixture parameters does not align with the stated objective of addressing chainlink account cloning issues and appears unrelated to the primary refactoring.
Removed multiple TaskSchedulerError variants (Transaction, TaskNotFound, TaskContextNotFound, SchedulingRequests, ContextSerialization, ContextDeserialization) (magicblock-task-scheduler/src/errors.rs) Error type simplification is not directly justified by the linked issue objective regarding account cloning and chainlink integration.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes check ❓ Inconclusive Changes include some out-of-scope modifications not directly required by issue #722, such as error handling refactoring and removal of integration tests. Verify whether the error handling changes, dependency updates, and test removal are intentional refactorings or should be addressed separately. Consider whether these changes align with the core objective of using Chainlink.
✅ Passed checks (1 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The pull request successfully replaces the transaction executor with an RPC client to send crank transactions via Chainlink, directly addressing issue #722's requirement.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
magicblock-api/src/magic_validator.rs (1)

287-297: RpcClient wiring correctly routes through JSON-RPC for Chainlink, but relies on non-wildcard listen addresses

Switching TaskSchedulerService::new to use RpcClient::new(config.listen.http()) correctly sends crank transactions through the node's JSON-RPC stack (and therefore through Chainlink) instead of hitting TransactionScheduler directly, aligning with #722.

However, the current BindAddress::http() method does not normalize unspecified addresses. If config.listen is configured as a wildcard bind (e.g. 0.0.0.0:8899 or [::]:8899), the RpcClient will receive an invalid endpoint like http://0.0.0.0:8899, causing transaction sends to fail. The default configuration uses 127.0.0.1:8899, which is safe.

To make this fully robust for wildcard configurations, either add normalization to BindAddress::http() to convert unspecified IPs to loopback, or document that listen must be a reachable address (not a wildcard bind).

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a69df0b and ada25b6.

📒 Files selected for processing (2)
  • magicblock-api/src/magic_validator.rs (1 hunks)
  • magicblock-config/src/types/network.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:110-122
Timestamp: 2025-11-04T10:53:50.922Z
Learning: In magicblock-processor, the TransactionScheduler runs in a single, dedicated thread and will always remain single-threaded. The `next_transaction_id()` function in scheduler/locks.rs uses `unsafe static mut` which is safe given this architectural guarantee.
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: test-kit/src/lib.rs:275-0
Timestamp: 2025-11-07T13:09:52.253Z
Learning: In test-kit, the transaction scheduler in ExecutionTestEnv is not expected to shut down during tests. Therefore, using `.unwrap()` in test helper methods like `schedule_transaction` is acceptable and will not cause issues in the test environment.
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.
📚 Learning: 2025-11-12T09:46:27.553Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-04T10:53:50.922Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:110-122
Timestamp: 2025-11-04T10:53:50.922Z
Learning: In magicblock-processor, the TransactionScheduler runs in a single, dedicated thread and will always remain single-threaded. The `next_transaction_id()` function in scheduler/locks.rs uses `unsafe static mut` which is safe given this architectural guarantee.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-13T09:38:43.804Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:64-102
Timestamp: 2025-11-13T09:38:43.804Z
Learning: In magicblock-processor's TransactionScheduler (scheduler/mod.rs line 59), the executor count is clamped to MAX_SVM_EXECUTORS (63) at initialization time, and executor IDs are assigned sequentially from 0 to count-1. This architectural guarantee ensures that executor IDs used in the bitmask-based AccountLock (scheduler/locks.rs) will always be within valid bounds for bit shifting operations, making runtime bounds checks unnecessary.

Applied to files:

  • magicblock-api/src/magic_validator.rs

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ada25b6 and f4301d7.

📒 Files selected for processing (2)
  • .gitignore (1 hunks)
  • test-integration/programs/schedulecommit/src/api.rs (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: test-kit/src/lib.rs:275-0
Timestamp: 2025-11-07T13:09:52.253Z
Learning: In test-kit, the transaction scheduler in ExecutionTestEnv is not expected to shut down during tests. Therefore, using `.unwrap()` in test helper methods like `schedule_transaction` is acceptable and will not cause issues in the test environment.
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:110-122
Timestamp: 2025-11-04T10:53:50.922Z
Learning: In magicblock-processor, the TransactionScheduler runs in a single, dedicated thread and will always remain single-threaded. The `next_transaction_id()` function in scheduler/locks.rs uses `unsafe static mut` which is safe given this architectural guarantee.
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.
🔇 Additional comments (1)
.gitignore (1)

22-22: Appropriate addition to .gitignore for test artifacts.

The new entry magicblock-test-storage/ correctly ignores test-generated storage artifacts and aligns with the removal of the task-scheduler integration test suite. The placement within the Ledger section is consistent with related test ledger ignores.

Copy link
Collaborator

@bmuddha bmuddha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand where the actual requests are taking place 🤔

Comment on lines 27 to 29
solana-sdk = { workspace = true }
solana-svm = { workspace = true }
solana-timings = { workspace = true }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why those dependencies are needed here? Also please use specific solana subcrates instead of sdk, unless you have to import too many of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in c231e0b, not sure where that was coming from...

@Dodecahedr0x
Copy link
Contributor Author

@bmuddha the request is done here

Copy link
Contributor

@taco-paco taco-paco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Step in the right direction. Hope one day we will stop using channels instead of function calls as well!

Minor comments

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
magicblock-account-cloner/src/lib.rs (1)

106-149: Hotfix fully disables frequency-based commits; consider making this explicit

The guard Some(commit_frequency_ms) if commit_frequency_ms > 0 && false makes the scheduling branch unreachable, so commit_frequency_ms is effectively ignored and only modify_ix is ever sent. That matches the “do not schedule frequency commits” hotfix comment but is quite implicit.

Consider either:

  • Gating the scheduling branch behind a clearly named constant/config flag (e.g. ENABLE_FREQUENCY_COMMITS: bool) instead of && false, and/or
  • Emitting at least a debug/warn log when commit_frequency_ms is Some(>0) to make it obvious that periodic commits are currently disabled.

This keeps the hotfix behavior while making it more self-documenting and easier to flip later.

magicblock-chainlink/src/submux/subscription_task.rs (1)

14-90: SubscribeProgram handling mirrors Subscribe; consider adding targeted tests

The new SubscribeProgram(Pubkey, usize) variant is wired consistently:

  • op_name, required_confirmations, and the zero-confirmations validation treat it identically to Subscribe.
  • Dispatch correctly calls client.subscribe_program(program_id).await.

Functionally this looks sound. To guard regressions, it would be useful to add a couple of small unit tests (similar to the existing Subscribe tests) that exercise:

  • A successful SubscribeProgram across one or more clients, and
  • The zero-confirmations error path for SubscribeProgram.

That would ensure the new variant stays behaviorally aligned with Subscribe as the API evolves.

magicblock-task-scheduler/src/service.rs (1)

194-223: Note: Transaction execution result is not verified.

The TODO comment at lines 197-201 correctly identifies that the transaction outcome isn't verified after send_transaction. Since the PR objective is to ensure accounts get cloned via Chainlink, consider whether transaction failures should be handled more proactively (e.g., by polling for confirmation or using send_and_confirm_transaction).

Would you like me to suggest an implementation using send_and_confirm_transaction or a separate confirmation polling task?

♻️ Duplicate comments (1)
magicblock-api/src/magic_validator.rs (1)

287-297: Consider encapsulating RpcClient construction inside TaskSchedulerService.

Creating RpcClient::new(config.listen.http()) here exposes internal details of TaskSchedulerService. Consider passing &config.listen (or config.listen.http()) to the service and letting it construct the RpcClient internally.

 let task_scheduler = TaskSchedulerService::new(
     &task_scheduler_db_path,
     &config.task_scheduler,
-    RpcClient::new(config.listen.http()),
+    config.listen.http(),
     dispatch
         .tasks_service
         .take()

This would require updating TaskSchedulerService::new signature to accept the URL and construct the client internally.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fbbf688 and a9e65c2.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock
  • test-integration/Cargo.lock is excluded by !**/*.lock
  • test-integration/programs/noop/noop.so is excluded by !**/*.so
📒 Files selected for processing (39)
  • .github/actions/setup-build-env/action.yml (1 hunks)
  • Cargo.toml (1 hunks)
  • config.example.toml (1 hunks)
  • magicblock-account-cloner/src/lib.rs (1 hunks)
  • magicblock-aperture/src/tests.rs (2 hunks)
  • magicblock-aperture/tests/setup.rs (2 hunks)
  • magicblock-api/src/magic_validator.rs (3 hunks)
  • magicblock-chainlink/src/chainlink/config.rs (2 hunks)
  • magicblock-chainlink/src/chainlink/mod.rs (7 hunks)
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs (17 hunks)
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs (6 hunks)
  • magicblock-chainlink/src/remote_account_provider/config.rs (5 hunks)
  • magicblock-chainlink/src/remote_account_provider/mod.rs (1 hunks)
  • magicblock-chainlink/src/submux/mod.rs (10 hunks)
  • magicblock-chainlink/src/submux/subscription_task.rs (5 hunks)
  • magicblock-chainlink/tests/utils/test_context.rs (2 hunks)
  • magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (1 hunks)
  • magicblock-config/src/config/chain.rs (2 hunks)
  • magicblock-ledger/Cargo.toml (1 hunks)
  • magicblock-magic-program-api/src/instruction.rs (1 hunks)
  • magicblock-processor/src/executor/mod.rs (1 hunks)
  • magicblock-processor/src/scheduler.rs (1 hunks)
  • magicblock-task-scheduler/src/service.rs (9 hunks)
  • programs/magicblock/src/magicblock_processor.rs (1 hunks)
  • programs/magicblock/src/schedule_task/process_schedule_task.rs (1 hunks)
  • programs/magicblock/src/test_utils/mod.rs (0 hunks)
  • programs/magicblock/src/utils/instruction_utils.rs (1 hunks)
  • test-integration/configs/schedule-task.devnet.toml (0 hunks)
  • test-integration/test-chainlink/src/ixtest_context.rs (2 hunks)
  • test-integration/test-chainlink/src/test_context.rs (2 hunks)
  • test-integration/test-task-scheduler/src/lib.rs (1 hunks)
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_scheduled_commits.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs (2 hunks)
  • test-kit/src/lib.rs (0 hunks)
💤 Files with no reviewable changes (3)
  • programs/magicblock/src/test_utils/mod.rs
  • test-integration/configs/schedule-task.devnet.toml
  • test-kit/src/lib.rs
🧰 Additional context used
🧠 Learnings (21)
📓 Common learnings
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.
📚 Learning: 2025-12-03T09:36:01.527Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: magicblock-chainlink/src/remote_account_provider/mod.rs:1350-1353
Timestamp: 2025-12-03T09:36:01.527Z
Learning: Repo: magicblock-labs/magicblock-validator
File: magicblock-chainlink/src/remote_account_provider/mod.rs
Context: consolidate_fetched_remote_accounts
Learning: For unexpected result counts (>2), the project prefers logging an error and returning an empty Vec over panicking; acceptable during development per maintainer (Dodecahedr0x).

Applied to files:

  • magicblock-chainlink/src/chainlink/config.rs
  • magicblock-committor-service/src/intent_executor/task_info_fetcher.rs
  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs
  • magicblock-aperture/src/tests.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-chainlink/src/submux/subscription_task.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • magicblock-config/src/config/chain.rs
  • magicblock-chainlink/tests/utils/test_context.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
  • magicblock-aperture/tests/setup.rs
  • test-integration/test-chainlink/src/test_context.rs
  • magicblock-chainlink/src/chainlink/mod.rs
  • test-integration/test-chainlink/src/ixtest_context.rs
  • magicblock-chainlink/src/submux/mod.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-chainlink/src/remote_account_provider/config.rs
📚 Learning: 2025-11-19T09:34:37.917Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: test-integration/test-chainlink/tests/ix_remote_account_provider.rs:62-63
Timestamp: 2025-11-19T09:34:37.917Z
Learning: In test-integration/test-chainlink/tests/ix_remote_account_provider.rs and similar test files, the `_fwd_rx` receiver returned by `init_remote_account_provider()` is intentionally kept alive (but unused) to prevent "receiver dropped" errors on the sender side. The pattern `let (remote_account_provider, _fwd_rx) = init_remote_account_provider().await;` should NOT be changed to `let (remote_account_provider, _) = ...` because dropping the receiver would cause send() operations to fail.

Applied to files:

  • magicblock-chainlink/src/chainlink/config.rs
  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • magicblock-chainlink/src/submux/subscription_task.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • magicblock-aperture/tests/setup.rs
  • test-integration/test-chainlink/src/ixtest_context.rs
  • magicblock-chainlink/src/submux/mod.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-chainlink/src/remote_account_provider/config.rs
  • test-integration/test-task-scheduler/tests/test_scheduled_commits.rs
📚 Learning: 2025-11-12T09:46:27.553Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.

Applied to files:

  • programs/magicblock/src/schedule_task/process_schedule_task.rs
  • magicblock-api/src/magic_validator.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-account-cloner/src/lib.rs
📚 Learning: 2025-10-14T09:56:14.047Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 564
File: test-integration/programs/flexi-counter/src/processor/call_handler.rs:122-125
Timestamp: 2025-10-14T09:56:14.047Z
Learning: The file test-integration/programs/flexi-counter/src/processor/call_handler.rs contains a test smart contract used for integration testing, not production code.

Applied to files:

  • programs/magicblock/src/schedule_task/process_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • magicblock-aperture/src/tests.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
  • test-integration/test-chainlink/src/ixtest_context.rs
  • test-integration/test-task-scheduler/tests/test_scheduled_commits.rs
📚 Learning: 2025-12-01T16:02:05.367Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 703
File: magicblock-chainlink/src/submux/mod.rs:652-654
Timestamp: 2025-12-01T16:02:05.367Z
Learning: In magicblock-chainlink/src/submux/mod.rs, the subscribe_program method intentionally adds program_id to program_subs before attempting the subscription. This ensures that even if the initial subscription fails or only partially succeeds across clients, the reconnection logic will retry the subscription. This is a deliberate design pattern for resilience in the multi-client architecture and should not be "fixed" to remove entries on failure.

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • magicblock-chainlink/src/submux/subscription_task.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs
  • magicblock-chainlink/src/submux/mod.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-chainlink/src/remote_account_provider/config.rs
📚 Learning: 2025-11-07T14:20:31.457Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs:457-495
Timestamp: 2025-11-07T14:20:31.457Z
Learning: In magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs, the unsubscribe closure returned by PubSubConnection::account_subscribe(...) resolves to () (unit), not a Result. Downstream code should not attempt to inspect an unsubscribe result and can optionally wrap it in a timeout to guard against hangs.

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • magicblock-chainlink/src/submux/subscription_task.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs
  • magicblock-chainlink/src/submux/mod.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-chainlink/src/remote_account_provider/config.rs
📚 Learning: 2025-10-26T16:53:29.820Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 587
File: magicblock-chainlink/src/remote_account_provider/mod.rs:134-0
Timestamp: 2025-10-26T16:53:29.820Z
Learning: In magicblock-chainlink/src/remote_account_provider/mod.rs, the `Endpoint::separate_pubsub_url_and_api_key()` method uses `split_once("?api-key=")` because the api-key parameter is always the only query parameter right after `?`. No additional query parameter parsing is needed for this use case.

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs
  • magicblock-chainlink/src/remote_account_provider/config.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-chainlink/src/submux/subscription_task.rs
  • magicblock-config/src/config/chain.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs
  • magicblock-chainlink/src/submux/mod.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-chainlink/src/remote_account_provider/config.rs
📚 Learning: 2025-11-07T13:09:52.253Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: test-kit/src/lib.rs:275-0
Timestamp: 2025-11-07T13:09:52.253Z
Learning: In test-kit, the transaction scheduler in ExecutionTestEnv is not expected to shut down during tests. Therefore, using `.unwrap()` in test helper methods like `schedule_transaction` is acceptable and will not cause issues in the test environment.

Applied to files:

  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
  • magicblock-task-scheduler/src/service.rs
  • test-integration/test-task-scheduler/tests/test_scheduled_commits.rs
📚 Learning: 2025-12-03T09:33:48.707Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: test-integration/test-committor-service/tests/test_ix_commit_local.rs:867-881
Timestamp: 2025-12-03T09:33:48.707Z
Learning: Repo: magicblock-labs/magicblock-validator PR: 639
Context: test-integration/test-committor-service/tests/test_ix_commit_local.rs (ix_commit_local)
Learning: The PhotonIndexer used for compressed account fetches (get_compressed_account) has built‑in retry logic (defaults to ~10 attempts), so tests should not add separate retry loops around compressed fetches unless there’s a specific need.

Applied to files:

  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
  • magicblock-account-cloner/src/lib.rs
  • test-integration/test-task-scheduler/tests/test_scheduled_commits.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.

Applied to files:

  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • magicblock-api/src/magic_validator.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-04T10:53:50.922Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:110-122
Timestamp: 2025-11-04T10:53:50.922Z
Learning: In magicblock-processor, the TransactionScheduler runs in a single, dedicated thread and will always remain single-threaded. The `next_transaction_id()` function in scheduler/locks.rs uses `unsafe static mut` which is safe given this architectural guarantee.

Applied to files:

  • magicblock-processor/src/scheduler.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-10-21T11:00:18.396Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/encoder.rs:176-187
Timestamp: 2025-10-21T11:00:18.396Z
Learning: In the magicblock validator, the current slot is always the root slot. The SlotEncoder in magicblock-aperture/src/encoder.rs correctly sets `root: slot` because there is no lag between current and root slots in this architecture.

Applied to files:

  • magicblock-processor/src/scheduler.rs
📚 Learning: 2025-11-13T09:38:43.804Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:64-102
Timestamp: 2025-11-13T09:38:43.804Z
Learning: In magicblock-processor's TransactionScheduler (scheduler/mod.rs line 59), the executor count is clamped to MAX_SVM_EXECUTORS (63) at initialization time, and executor IDs are assigned sequentially from 0 to count-1. This architectural guarantee ensures that executor IDs used in the bitmask-based AccountLock (scheduler/locks.rs) will always be within valid bounds for bit shifting operations, making runtime bounds checks unnecessary.

Applied to files:

  • magicblock-processor/src/scheduler.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-07T13:20:13.793Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/coordinator.rs:227-238
Timestamp: 2025-11-07T13:20:13.793Z
Learning: In magicblock-processor's ExecutionCoordinator (scheduler/coordinator.rs), the `account_contention` HashMap intentionally does not call `shrink_to_fit()`. Maintaining slack capacity is beneficial for performance by avoiding frequent reallocations during high transaction throughput. As long as empty entries are removed from the map (which `clear_account_contention` does), the capacity overhead is acceptable.

Applied to files:

  • magicblock-processor/src/scheduler.rs
📚 Learning: 2025-10-28T13:15:42.706Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 596
File: magicblock-processor/src/scheduler.rs:1-1
Timestamp: 2025-10-28T13:15:42.706Z
Learning: In magicblock-processor, transaction indexes were always set to 0 even before the changes in PR #596. The proper transaction indexing within slots will be addressed during the planned ledger rewrite.

Applied to files:

  • magicblock-processor/src/scheduler.rs
📚 Learning: 2025-11-24T14:21:00.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: Cargo.toml:58-58
Timestamp: 2025-11-24T14:21:00.996Z
Learning: In the magicblock-validator codebase, magicblock-api/Cargo.toml intentionally uses borsh = "1.5.3" (instead of the workspace version 0.10.4) because it needs to deserialize types from the magic-domain-program external dependency, which requires borsh 1.5.x compatibility. This is an intentional exception for interoperability with the magic domain program.

Applied to files:

  • Cargo.toml
  • magicblock-ledger/Cargo.toml
  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-24T08:45:11.164Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 675
File: Cargo.toml:145-145
Timestamp: 2025-11-24T08:45:11.164Z
Learning: The reqwest dependency version 0.11 is intentionally used in the magicblock-validator project to maintain compatibility with the Solana client dependencies.

Applied to files:

  • Cargo.toml
📚 Learning: 2025-11-04T10:48:00.070Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/mod.rs:217-219
Timestamp: 2025-11-04T10:48:00.070Z
Learning: In magicblock-validator, the codebase uses a pattern where types containing non-Send/non-Sync fields (like Rc<RefCell<...>>) are marked with unsafe impl Send when they are guaranteed to be confined to a single thread through careful API design and thread spawning patterns.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.

Applied to files:

  • magicblock-api/src/magic_validator.rs
  • magicblock-task-scheduler/src/service.rs
🧬 Code graph analysis (13)
programs/magicblock/src/schedule_task/process_schedule_task.rs (2)
programs/magicblock/src/test_utils/mod.rs (1)
  • process_instruction (42-59)
programs/magicblock/src/utils/instruction_utils.rs (1)
  • noop_instruction (285-291)
magicblock-chainlink/src/remote_account_provider/mod.rs (1)
magicblock-chainlink/src/remote_account_provider/config.rs (1)
  • program_subs (74-76)
test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs (3)
test-integration/test-task-scheduler/src/lib.rs (1)
  • create_delegated_counter (75-124)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
test-integration/test-task-scheduler/tests/test_reschedule_task.rs (3)
test-integration/test-task-scheduler/src/lib.rs (1)
  • create_delegated_counter (75-124)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
magicblock-api/src/magic_validator.rs (3)
magicblock-task-scheduler/src/service.rs (1)
  • new (64-97)
magicblock-chainlink/src/chainlink/config.rs (2)
  • new (12-17)
  • default_with_lifecycle_mode (19-27)
magicblock-api/src/domain_registry_manager.rs (1)
  • new (28-35)
magicblock-chainlink/src/submux/subscription_task.rs (1)
magicblock-version/src/lib.rs (1)
  • client (42-44)
test-integration/test-task-scheduler/tests/test_schedule_error.rs (3)
test-integration/test-task-scheduler/src/lib.rs (2)
  • create_delegated_counter (75-124)
  • setup_validator (35-73)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
test-integration/test-task-scheduler/tests/test_schedule_task.rs (3)
test-integration/test-task-scheduler/src/lib.rs (2)
  • create_delegated_counter (75-124)
  • setup_validator (35-73)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs (1)
magicblock-chainlink/src/submux/mod.rs (1)
  • subscribe_program (641-662)
test-integration/test-chainlink/src/ixtest_context.rs (4)
magicblock-api/src/magic_validator.rs (1)
  • config (367-374)
magicblock-chainlink/src/remote_account_provider/config.rs (1)
  • default (80-88)
magicblock-chainlink/src/remote_account_provider/mod.rs (1)
  • default (125-131)
magicblock-config/src/config/chain.rs (1)
  • default (20-24)
magicblock-chainlink/src/submux/mod.rs (2)
magicblock-chainlink/src/remote_account_provider/config.rs (2)
  • program_subs (74-76)
  • default (80-88)
magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs (3)
  • subscribe_program (154-157)
  • subscribe_program (254-270)
  • subscribe_program (455-469)
magicblock-task-scheduler/src/service.rs (1)
programs/magicblock/src/utils/instruction_utils.rs (1)
  • noop_instruction (285-291)
test-integration/test-task-scheduler/tests/test_scheduled_commits.rs (3)
test-integration/test-task-scheduler/src/lib.rs (2)
  • create_delegated_counter (75-124)
  • setup_validator (35-73)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
🔇 Additional comments (63)
.github/actions/setup-build-env/action.yml (1)

30-37: LGTM—verify that libclang-dev is actually required.

The syntax and structure are correct: the multi-line script format, apt-get update before install, and the -y flag are all appropriate for CI. However, ensure that libclang-dev is genuinely needed by the updated codebase. If adding it here is a response to build failures in the wider PR changes (e.g., due to new dependencies introduced by RPC client integration), that context should be documented in the PR description or commit message.

magicblock-committor-service/src/intent_executor/task_info_fetcher.rs (1)

9-9: LGTM! Good cleanup of unused import.

The removal of the unused error import is appropriate since only warn! is used in this file.

magicblock-processor/src/scheduler.rs (1)

143-152: LGTM! Good consolidation of cache operations under a single lock scope.

The refactor correctly:

  1. Acquires the write lock once instead of potentially multiple times.
  2. Adds necessary prune() cleanup to prevent cache corruption from duplicate entries.
  3. Ensures atomicity between pruning and updating latest_root_slot.

The comment explaining why pruning is important is helpful for future maintainers.

test-integration/test-task-scheduler/src/lib.rs (1)

29-29: LGTM: Import cleanup aligns with removal of NOOP utilities.

The import adjustments correctly reflect the removal of NOOP_PROGRAM_ID and send_noop_tx, keeping only the necessary items for the remaining test helpers.

test-integration/test-task-scheduler/tests/test_schedule_error.rs (1)

31-32: LGTM: Cleaner blockhash retrieval.

Replacing the noop transaction workaround with direct blockhash retrieval via ctx.try_get_latest_blockhash_ephem() is more straightforward and aligns with the PR's shift to using the RPC client through Chainlink.

test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs (1)

35-36: LGTM: Consistent refactoring.

The blockhash retrieval update matches the pattern applied across all test files.

test-integration/test-task-scheduler/tests/test_reschedule_task.rs (1)

30-31: LGTM: Consistent refactoring.

test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs (1)

30-31: LGTM: Consistent refactoring.

test-integration/test-task-scheduler/tests/test_schedule_task.rs (1)

30-31: LGTM: Consistent refactoring.

test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs (1)

25-26: LGTM: Consistent refactoring.

test-integration/test-task-scheduler/tests/test_scheduled_commits.rs (2)

25-26: LGTM: Consistent blockhash retrieval refactoring.


13-13: Clarify why this test is ignored.

The #[ignore] attribute was added without explanation. Is this test temporarily disabled due to the RPC client changes, or is there a known issue that needs to be addressed separately?

Please clarify:

  1. Why is this test now ignored?
  2. Is this temporary or permanent?
  3. If temporary, is there a tracking issue?
programs/magicblock/src/magicblock_processor.rs (1)

80-80: LGTM!

The Noop instruction handler correctly returns success without performing any operations, which is the expected behavior for a no-op instruction.

programs/magicblock/src/schedule_task/process_schedule_task.rs (1)

157-163: LGTM! Clean test refactoring.

The migration from using an external NOOP_PROGRAM_ID to the internal Noop instruction via InstructionUtils::noop_instruction(0) improves test self-containment and removes an external dependency.

programs/magicblock/src/utils/instruction_utils.rs (1)

282-291: LGTM!

The helper function correctly constructs a Noop instruction with the MagicBlock program ID and empty account metadata, following the same pattern as other instruction helpers in this module.

magicblock-ledger/Cargo.toml (1)

33-33: Rocksdb dependency correctly aligned with workspace.

The switch to { workspace = true, default-features = false, features = ["lz4"] } properly references the newly introduced workspace rocksdb dependency and maintains feature consistency. This refactoring follows best practices for workspace dependency management.

Cargo.toml (2)

195-212: Resolve RocksDB version mismatch between workspace dependency and git patch.

The workspace declares rocksdb = "0.22.0" but the patch references git revision d4e9e16, which is part of v0.23.0 (not v0.22.0). This version mismatch will cause Cargo to apply code from a different minor version than declared, risking compatibility issues and unexpected behavior. Either update the workspace version to 0.23.0 or use a git revision that corresponds to the 0.22.0 release.

⛔ Skipped due to learnings
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: Cargo.toml:58-58
Timestamp: 2025-11-24T14:21:00.996Z
Learning: In the magicblock-validator codebase, magicblock-api/Cargo.toml intentionally uses borsh = "1.5.3" (instead of the workspace version 0.10.4) because it needs to deserialize types from the magic-domain-program external dependency, which requires borsh 1.5.x compatibility. This is an intentional exception for interoperability with the magic domain program.
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: test-integration/programs/schedulecommit/Cargo.toml:19-20
Timestamp: 2025-11-07T18:19:48.996Z
Learning: In Solana programs (crates depending on solana-program), the empty feature flags `custom-heap = []` and `custom-panic = []` are standard declarations required to avoid compiler warnings. These should not be flagged as unused features in Cargo.toml files for Solana program crates.

190-193: Remove this comment - solana-svm revision verification is not applicable to RPC client changes.

The solana-svm dependency is used in magicblock-processor for transaction execution, not in the RPC aperture layer. RPC methods like sendTransaction and simulateTransaction interact with the transaction scheduler at a higher level and don't directly depend on solana-svm. Unless this PR modifies transaction processing logic in magicblock-processor, the solana-svm revision change does not require verification for RPC client compatibility.

Likely an incorrect or invalid review comment.

magicblock-processor/src/executor/mod.rs (1)

242-252: Confirm ForkGraph::relationship argument semantics and forkless assumption

This linear implementation looks correct under the stated assumption of a strictly forkless, monotonically increasing slot sequence: earlier slots as ancestors, later as descendants, equal as Equal. It’s also a clear improvement over always returning Unrelated.

Two things are worth explicitly double‑checking against the current Solana ForkGraph usage:

  • That relationship(a, b) is indeed defined as “relationship of the block at a relative to the block at b”, so a < b => Ancestor matches the expected direction.
  • That no call sites rely on Unrelated/Unknown being returned (since this implementation will never produce them), especially in any program‑cache invalidation or eviction paths.

If both hold and the environment truly guarantees no forks, this implementation is good as‑is.

magicblock-aperture/tests/setup.rs (1)

20-67: ChainLinkConfig wiring in test setup looks correct

Using ChainLinkConfig::default() and passing &ChainLinkConfig into ChainlinkImpl::try_new matches the new config-driven API and keeps tests aligned with defaults. No issues spotted.

config.example.toml (1)

182-185: New remove-confined-accounts option is consistent with existing config style

Field name, default, and MBV_CHAINLINK__REMOVE_CONFINED_ACCOUNTS env var follow the established conventions in this file; no issues from the example-config perspective.

magicblock-aperture/src/tests.rs (1)

11-52: ChainLinkConfig usage in aperture tests aligns with new API

Importing ChainLinkConfig and passing a local &ChainLinkConfig::default() into ChainlinkImpl::try_new is a clean adaptation to the new signature and keeps tests using default chainlink behavior.

magicblock-chainlink/src/remote_account_provider/mod.rs (1)

381-405: Program subscriptions from config are eagerly established; verify desired failure semantics

Hooking config.program_subs() into SubMuxClient at startup and logging the list is good, and calling subscribe_program here respects the SubMux “remember program_subs and resubscribe on reconnect” pattern.

Because of the ?, if any subscribe_program call fails hard (i.e., doesn’t reach the required confirmations across all clients), try_new_from_urls returns an error and the RemoteAccountProvider isn’t constructed. That’s a reasonable “fail-fast” choice if configured program subscriptions are mandatory, but it does mean transient issues on those subscriptions will prevent chainlink from starting.

Please double-check that this strict behavior is intended; if program subscriptions are meant to be best-effort, you might instead want to log failures and proceed, relying on the reconnection logic to heal later.

Based on learnings, this keeps SubMux’s program_subs-based reconnection behavior intact.

magicblock-chainlink/src/chainlink/config.rs (1)

5-27: remove_confined_accounts field is correctly added and defaulted

Adding pub remove_confined_accounts: bool and initializing it to false in both new and default_with_lifecycle_mode keeps defaults consistent with the derived Default and avoids surprising behavior changes unless explicitly configured.

test-integration/test-chainlink/src/test_context.rs (1)

26-129: Test context’s ChainLinkConfig usage matches the new Chainlink::try_new signature

Importing ChainLinkConfig and passing &ChainLinkConfig::default() into Chainlink::try_new correctly adapts the test harness to the new API while keeping behavior on defaults; the separate lifecycle_mode fed into RemoteAccountProviderConfig remains unchanged and appropriate for these tests.

magicblock-chainlink/tests/utils/test_context.rs (1)

110-117: LGTM!

The Chainlink::try_new call now correctly passes &ChainLinkConfig::default() to align with the updated constructor signature that accepts a config reference.

magicblock-config/src/config/chain.rs (1)

44-58: LGTM!

The addition of serde(default) enables graceful deserialization when fields are missing from config files. The new remove_confined_accounts field is well-documented and defaults to false (via Default derive), which is a safe default for this feature flag.

test-integration/test-chainlink/src/ixtest_context.rs (2)

26-26: LGTM!

Import correctly includes both ChainLinkConfig and LifecycleMode, both of which are used in this file.


143-150: LGTM!

The Chainlink::try_new call correctly uses &ChainLinkConfig::default() to match the updated constructor signature.

magicblock-api/src/magic_validator.rs (2)

385-389: LGTM with minor observation.

The propagation of remove_confined_accounts from config.chainlink to chainlink_config is correct. Consider whether future fields should follow the same pattern or if a more systematic approach (e.g., deriving from the same config source) would be cleaner.


394-404: LGTM!

The ChainlinkImpl::try_new_from_endpoints call correctly passes &config.chainlink as the final argument, aligning with the updated constructor signature.

magicblock-chainlink/src/remote_account_provider/config.rs (5)

1-4: LGTM!

Imports for HashSet and Pubkey are correctly added to support the new program_subs field.


14-23: LGTM!

The new program_subs field is well-documented as a backup subscription mechanism for program accounts. The documentation clearly explains its purpose.


47-52: LGTM!

Using ..Default::default() in try_new_with_metrics ensures forward compatibility when new fields are added to the struct.


73-76: LGTM!

The accessor returns a reference to the HashSet, which is appropriate for read-only access.


79-88: LGTM!

The default implementation correctly initializes program_subs with dlp::id() (the delegation program), which is a sensible default for the subscription backup mechanism.

magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs (6)

17-20: LGTM!

Imports correctly added for the new program subscription types: RpcProgramAccountsConfig and RpcKeyedAccount.


39-42: LGTM!

The ProgramSubscribeResult type alias mirrors the existing SubscribeResult pattern, maintaining consistency in the codebase.


154-157: LGTM!

The subscribe_program method is correctly added to the ChainPubsubClient trait with a consistent signature pattern.


254-270: LGTM!

The subscribe_program implementation correctly:

  1. Uses the actor message pattern consistent with subscribe
  2. Sends ChainPubsubActorMessage::ProgramSubscribe
  3. Includes appropriate error logging with inspect_err

455-469: LGTM!

The mock implementation correctly:

  1. Checks connection state before allowing subscription
  2. Returns appropriate error when disconnected
  3. Documents that program subscriptions don't track individual accounts in the mock

89-110: Unsafe lifetime extension consistently applied across subscription methods.

Both account_subscribe (lines 80–85) and program_subscribe (lines 103–108) use identical unsafe transmute patterns to extend stream lifetimes to 'static. The safety comments are consistent and correctly document the reasoning: the stream depends on the client instance, which is only dropped when the connection terminates, at which point the stream is discarded regardless.

magicblock-chainlink/src/chainlink/mod.rs (4)

13-13: LGTM!

Import addition for ChainLinkConfig is correctly placed and aligns with the config-based parameter refactoring.


65-68: LGTM!

The remove_confined_accounts field is well-documented and correctly typed. The blank line before the doc comment improves readability.


73-99: LGTM - Config-based initialization is cleaner.

The signature change from individual parameters to &ChainLinkConfig improves API ergonomics and extensibility. Field initialization from config is straightforward.


102-151: LGTM!

The try_new_from_endpoints signature update correctly propagates chainlink_config to the inner try_new call, maintaining consistency across the initialization paths.

magicblock-chainlink/src/submux/mod.rs (5)

140-142: LGTM!

The program_subs field correctly uses Arc<Mutex<HashSet<Pubkey>>> for thread-safe sharing across reconnection tasks, consistent with the existing subscriptions pattern.


205-228: LGTM!

Initialization and propagation of program_subs through the reconnector spawn path is correctly wired. The clone before passing to spawn ensures each task has its own Arc reference.


240-268: LGTM!

The spawn_reconnectors function correctly clones program_subs for each client's reconnection task, ensuring the shared state is accessible during reconnection attempts.


641-662: LGTM - Resilient subscription pattern correctly implemented.

The subscribe_program method correctly adds to program_subs before attempting the subscription, ensuring reconnection logic will retry failed subscriptions. This aligns with the established pattern per project learnings.

The warn! log level for existing subscriptions is appropriate as it indicates a potential logic issue in the caller without being an error.


330-343: Consider whether program resubscription failure should abort the entire reconnect.

Currently, if any single program subscription fails during reconnect, the entire reconnect is considered failed and will be retried. This is conservative but may cause unnecessary retry loops if a single program consistently fails to subscribe while others succeed.

Consider whether partial success (logging the failure but continuing with other programs) would be more resilient, similar to how account subscription failures are handled in some systems.

⛔ Skipped due to learnings
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 703
File: magicblock-chainlink/src/submux/mod.rs:652-654
Timestamp: 2025-12-01T16:02:05.367Z
Learning: In magicblock-chainlink/src/submux/mod.rs, the subscribe_program method intentionally adds program_id to program_subs before attempting the subscription. This ensures that even if the initial subscription fails or only partially succeeds across clients, the reconnection logic will retry the subscription. This is a deliberate design pattern for resilience in the multi-client architecture and should not be "fixed" to remove entries on failure.
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs:457-495
Timestamp: 2025-11-07T14:20:31.457Z
Learning: In magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs, the unsubscribe closure returned by PubSubConnection::account_subscribe(...) resolves to () (unit), not a Result. Downstream code should not attempt to inspect an unsubscribe result and can optionally wrap it in a timeout to guard against hangs.
magicblock-task-scheduler/src/service.rs (5)

10-21: LGTM!

Import reorganization correctly brings in RpcClient from solana_rpc_client::nonblocking and splits SDK types into their respective crates (solana_instruction, solana_message, etc.).


33-50: LGTM!

The struct field change from tx_scheduler: TransactionSchedulerHandle to rpc_client: RpcClient correctly reflects the architectural shift to using RPC for transaction submission.


52-55: LGTM!

Boxing TaskSchedulerError in Recoverable is appropriate since RPC client errors can be large, and this avoids bloating the enum variant size.


64-97: LGTM!

Constructor correctly accepts RpcClient and returns TaskSchedulerResult<Self>. The initialization path remains unchanged except for the field name.


301-329: The error type compatibility is correctly implemented. TaskSchedulerError has an Rpc variant that accepts Box<solana_rpc_client_api::client_error::Error> with the #[from] attribute, which auto-generates the From implementation. The map_err(Box::new) call properly converts ClientError to Box<ClientError>, which is then automatically converted to TaskSchedulerError::Rpc.

magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs (7)

14-17: LGTM!

Import additions for RpcProgramAccountsConfig and Response alias are correctly placed for the new program subscription functionality.


84-86: LGTM!

The program_subs field mirrors the subscriptions field structure, maintaining consistency in how account and program subscriptions are tracked.


101-125: LGTM - Well-documented message variants.

The ProgramSubscribe variant is well-documented with the important note that only updates for accounts also in subscriptions will be forwarded. This documents the intentional filtering behavior.


176-192: LGTM!

Shutdown correctly drains both subscriptions and program_subs using iterator chaining, ensuring all subscription tasks are cancelled cleanly.


522-653: LGTM - Program subscription implementation is well-structured.

The add_program_sub function correctly:

  1. Checks for existing subscriptions to avoid duplicates
  2. Inserts cancellation token before async subscription to prevent race conditions
  3. Filters updates to only forward accounts that are also directly subscribed (lines 609)
  4. Handles EOF by signaling connection issues
  5. Cleans up with timeout on unsubscribe

The filtering at line 609 implements the documented behavior from the enum variant comment.


712-732: Good refactoring - DRY improvement for subscription draining.

The drain_subscriptions helper function reduces code duplication and makes the abort logic cleaner. The function correctly:

  1. Takes ownership of all subscriptions via std::mem::take
  2. Cancels each subscription's token
  3. Logs the count of cancelled subscriptions

604-620: Potential performance concern with lock acquisition in hot path.

The subs.lock() call inside the update loop (line 609) acquires a mutex lock for every program account update. If the program has many accounts with frequent updates, this could become a bottleneck.

Consider caching the subscribed accounts set periodically or using a read-optimized concurrent data structure if performance becomes an issue.

⛔ Skipped due to learnings
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/coordinator.rs:227-238
Timestamp: 2025-11-07T13:20:13.793Z
Learning: In magicblock-processor's ExecutionCoordinator (scheduler/coordinator.rs), the `account_contention` HashMap intentionally does not call `shrink_to_fit()`. Maintaining slack capacity is beneficial for performance by avoiding frequent reallocations during high transaction throughput. As long as empty entries are removed from the map (which `clear_account_contention` does), the capacity overhead is acceptable.
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 703
File: magicblock-chainlink/src/submux/mod.rs:652-654
Timestamp: 2025-12-01T16:02:05.367Z
Learning: In magicblock-chainlink/src/submux/mod.rs, the subscribe_program method intentionally adds program_id to program_subs before attempting the subscription. This ensures that even if the initial subscription fails or only partially succeeds across clients, the reconnection logic will retry the subscription. This is a deliberate design pattern for resilience in the multi-client architecture and should not be "fixed" to remove entries on failure.
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-accounts-db/src/lib.rs:63-72
Timestamp: 2025-10-21T10:34:59.140Z
Learning: In magicblock-validator, the AccountsDb "stop-the-world" synchronizer is managed at the processor/executor level, not at the AccountsDb API level. Transaction executors in magicblock-processor hold a read lock (sync.read()) for the duration of each slot and release it only at slot boundaries, ensuring all account writes happen under the read lock. Snapshot operations acquire a write lock, blocking until all executors release their read locks. This pattern ensures mutual exclusion between writes and snapshots without requiring read guards in AccountsDb write APIs.
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs:457-495
Timestamp: 2025-11-07T14:20:31.457Z
Learning: In magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs, the unsubscribe closure returned by PubSubConnection::account_subscribe(...) resolves to () (unit), not a Result. Downstream code should not attempt to inspect an unsubscribe result and can optionally wrap it in a timeout to guard against hangs.

@Dodecahedr0x Dodecahedr0x force-pushed the dode/schedule-with-rpc branch from d880a89 to ff66c7b Compare December 8, 2025 08:34
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
magicblock-task-scheduler/src/service.rs (1)

33-50: RpcClient injection into TaskSchedulerService looks good; consider refreshing surrounding comments

The new rpc_client: RpcClient field and corresponding constructor parameter cleanly decouple the scheduler from the old executor and align with the “send crank txs via RPC” objective. Struct initialization in new is consistent and there are no ownership/lifetime issues.

Two small follow‑ups for clarity:

  • Line 38: scheduled_tasks’s doc string still mentions “transaction executor”, which is no longer accurate with the new wiring.
  • Lines 57‑60: the SAFETY comment still refers to TransactionSchedulerHandle; updating it to mention RpcClient (and dropping obsolete types) will keep the unsafe justification in sync with the actual fields.

Also applies to: 64-71, 87-90

♻️ Duplicate comments (1)
magicblock-magic-program-api/src/instruction.rs (1)

103-105: Clarify the semantics of the Noop(u64) payload

Noop(u64) is now part of the public instruction API, but the doc comment doesn’t explain what the u64 represents or whether it’s ignored by the processor (currently matched as Noop(_)). Expanding the docs will help callers understand if this is simply a nonce/unique identifier or reserved for future use.

You could apply something along these lines:

-    /// Noop instruction
-    Noop(u64),
+    /// Noop instruction (no operation).
+    ///
+    /// The `u64` payload is not interpreted by the program and can be used
+    /// by callers as a nonce/unique identifier (e.g. for tests or tx hashing).
+    /// It is currently ignored during execution.
+    Noop(u64),
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a9e65c2 and ff66c7b.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock
  • test-integration/Cargo.lock is excluded by !**/*.lock
  • test-integration/programs/noop/noop.so is excluded by !**/*.so
📒 Files selected for processing (22)
  • .github/actions/setup-build-env/action.yml (1 hunks)
  • Cargo.toml (1 hunks)
  • magicblock-account-cloner/src/lib.rs (1 hunks)
  • magicblock-ledger/Cargo.toml (1 hunks)
  • magicblock-magic-program-api/src/instruction.rs (1 hunks)
  • magicblock-processor/src/executor/mod.rs (1 hunks)
  • magicblock-processor/src/scheduler.rs (1 hunks)
  • magicblock-task-scheduler/src/service.rs (9 hunks)
  • programs/magicblock/src/magicblock_processor.rs (1 hunks)
  • programs/magicblock/src/schedule_task/process_schedule_task.rs (1 hunks)
  • programs/magicblock/src/test_utils/mod.rs (0 hunks)
  • programs/magicblock/src/utils/instruction_utils.rs (1 hunks)
  • test-integration/configs/schedule-task.devnet.toml (0 hunks)
  • test-integration/test-task-scheduler/src/lib.rs (1 hunks)
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_scheduled_commits.rs (2 hunks)
  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs (2 hunks)
  • test-kit/src/lib.rs (0 hunks)
💤 Files with no reviewable changes (3)
  • test-kit/src/lib.rs
  • programs/magicblock/src/test_utils/mod.rs
  • test-integration/configs/schedule-task.devnet.toml
🧰 Additional context used
🧠 Learnings (16)
📓 Common learnings
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.
📚 Learning: 2025-11-07T13:09:52.253Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: test-kit/src/lib.rs:275-0
Timestamp: 2025-11-07T13:09:52.253Z
Learning: In test-kit, the transaction scheduler in ExecutionTestEnv is not expected to shut down during tests. Therefore, using `.unwrap()` in test helper methods like `schedule_transaction` is acceptable and will not cause issues in the test environment.

Applied to files:

  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs
  • test-integration/test-task-scheduler/tests/test_scheduled_commits.rs
  • magicblock-task-scheduler/src/service.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
📚 Learning: 2025-10-14T09:56:14.047Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 564
File: test-integration/programs/flexi-counter/src/processor/call_handler.rs:122-125
Timestamp: 2025-10-14T09:56:14.047Z
Learning: The file test-integration/programs/flexi-counter/src/processor/call_handler.rs contains a test smart contract used for integration testing, not production code.

Applied to files:

  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • programs/magicblock/src/schedule_task/process_schedule_task.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs
  • test-integration/test-task-scheduler/tests/test_scheduled_commits.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
📚 Learning: 2025-12-03T09:33:48.707Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: test-integration/test-committor-service/tests/test_ix_commit_local.rs:867-881
Timestamp: 2025-12-03T09:33:48.707Z
Learning: Repo: magicblock-labs/magicblock-validator PR: 639
Context: test-integration/test-committor-service/tests/test_ix_commit_local.rs (ix_commit_local)
Learning: The PhotonIndexer used for compressed account fetches (get_compressed_account) has built‑in retry logic (defaults to ~10 attempts), so tests should not add separate retry loops around compressed fetches unless there’s a specific need.

Applied to files:

  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs
  • test-integration/test-task-scheduler/tests/test_scheduled_commits.rs
  • magicblock-account-cloner/src/lib.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
📚 Learning: 2025-11-19T09:34:37.917Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: test-integration/test-chainlink/tests/ix_remote_account_provider.rs:62-63
Timestamp: 2025-11-19T09:34:37.917Z
Learning: In test-integration/test-chainlink/tests/ix_remote_account_provider.rs and similar test files, the `_fwd_rx` receiver returned by `init_remote_account_provider()` is intentionally kept alive (but unused) to prevent "receiver dropped" errors on the sender side. The pattern `let (remote_account_provider, _fwd_rx) = init_remote_account_provider().await;` should NOT be changed to `let (remote_account_provider, _) = ...` because dropping the receiver would cause send() operations to fail.

Applied to files:

  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs
  • test-integration/test-task-scheduler/tests/test_scheduled_commits.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
📚 Learning: 2025-12-03T09:36:01.527Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: magicblock-chainlink/src/remote_account_provider/mod.rs:1350-1353
Timestamp: 2025-12-03T09:36:01.527Z
Learning: Repo: magicblock-labs/magicblock-validator
File: magicblock-chainlink/src/remote_account_provider/mod.rs
Context: consolidate_fetched_remote_accounts
Learning: For unexpected result counts (>2), the project prefers logging an error and returning an empty Vec over panicking; acceptable during development per maintainer (Dodecahedr0x).

Applied to files:

  • test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs
  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
📚 Learning: 2025-11-12T09:46:27.553Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.

Applied to files:

  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • programs/magicblock/src/schedule_task/process_schedule_task.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-account-cloner/src/lib.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.

Applied to files:

  • test-integration/test-task-scheduler/tests/test_schedule_error.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task.rs
  • test-integration/test-task-scheduler/tests/test_reschedule_task.rs
  • magicblock-task-scheduler/src/service.rs
  • test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs
📚 Learning: 2025-11-04T10:53:50.922Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:110-122
Timestamp: 2025-11-04T10:53:50.922Z
Learning: In magicblock-processor, the TransactionScheduler runs in a single, dedicated thread and will always remain single-threaded. The `next_transaction_id()` function in scheduler/locks.rs uses `unsafe static mut` which is safe given this architectural guarantee.

Applied to files:

  • magicblock-processor/src/scheduler.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-10-21T11:00:18.396Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/encoder.rs:176-187
Timestamp: 2025-10-21T11:00:18.396Z
Learning: In the magicblock validator, the current slot is always the root slot. The SlotEncoder in magicblock-aperture/src/encoder.rs correctly sets `root: slot` because there is no lag between current and root slots in this architecture.

Applied to files:

  • magicblock-processor/src/scheduler.rs
📚 Learning: 2025-11-13T09:38:43.804Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:64-102
Timestamp: 2025-11-13T09:38:43.804Z
Learning: In magicblock-processor's TransactionScheduler (scheduler/mod.rs line 59), the executor count is clamped to MAX_SVM_EXECUTORS (63) at initialization time, and executor IDs are assigned sequentially from 0 to count-1. This architectural guarantee ensures that executor IDs used in the bitmask-based AccountLock (scheduler/locks.rs) will always be within valid bounds for bit shifting operations, making runtime bounds checks unnecessary.

Applied to files:

  • magicblock-processor/src/scheduler.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-07T13:20:13.793Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/coordinator.rs:227-238
Timestamp: 2025-11-07T13:20:13.793Z
Learning: In magicblock-processor's ExecutionCoordinator (scheduler/coordinator.rs), the `account_contention` HashMap intentionally does not call `shrink_to_fit()`. Maintaining slack capacity is beneficial for performance by avoiding frequent reallocations during high transaction throughput. As long as empty entries are removed from the map (which `clear_account_contention` does), the capacity overhead is acceptable.

Applied to files:

  • magicblock-processor/src/scheduler.rs
📚 Learning: 2025-10-28T13:15:42.706Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 596
File: magicblock-processor/src/scheduler.rs:1-1
Timestamp: 2025-10-28T13:15:42.706Z
Learning: In magicblock-processor, transaction indexes were always set to 0 even before the changes in PR #596. The proper transaction indexing within slots will be addressed during the planned ledger rewrite.

Applied to files:

  • magicblock-processor/src/scheduler.rs
📚 Learning: 2025-11-24T14:21:00.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: Cargo.toml:58-58
Timestamp: 2025-11-24T14:21:00.996Z
Learning: In the magicblock-validator codebase, magicblock-api/Cargo.toml intentionally uses borsh = "1.5.3" (instead of the workspace version 0.10.4) because it needs to deserialize types from the magic-domain-program external dependency, which requires borsh 1.5.x compatibility. This is an intentional exception for interoperability with the magic domain program.

Applied to files:

  • magicblock-ledger/Cargo.toml
  • Cargo.toml
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-24T08:45:11.164Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 675
File: Cargo.toml:145-145
Timestamp: 2025-11-24T08:45:11.164Z
Learning: The reqwest dependency version 0.11 is intentionally used in the magicblock-validator project to maintain compatibility with the Solana client dependencies.

Applied to files:

  • Cargo.toml
🧬 Code graph analysis (8)
test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs (3)
test-integration/test-task-scheduler/src/lib.rs (2)
  • create_delegated_counter (75-124)
  • setup_validator (35-73)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
test-integration/test-task-scheduler/tests/test_schedule_error.rs (3)
test-integration/test-task-scheduler/src/lib.rs (2)
  • create_delegated_counter (75-124)
  • setup_validator (35-73)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
programs/magicblock/src/schedule_task/process_schedule_task.rs (2)
programs/magicblock/src/test_utils/mod.rs (1)
  • process_instruction (42-59)
programs/magicblock/src/utils/instruction_utils.rs (1)
  • noop_instruction (285-291)
test-integration/test-task-scheduler/tests/test_schedule_task.rs (3)
test-integration/test-task-scheduler/src/lib.rs (1)
  • setup_validator (35-73)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs (2)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
test-integration/test-task-scheduler/tests/test_reschedule_task.rs (2)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
magicblock-task-scheduler/src/service.rs (2)
programs/magicblock/src/validator.rs (2)
  • validator_authority (26-33)
  • validator_authority_id (35-42)
programs/magicblock/src/utils/instruction_utils.rs (1)
  • noop_instruction (285-291)
test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs (3)
test-integration/test-task-scheduler/src/lib.rs (2)
  • create_delegated_counter (75-124)
  • setup_validator (35-73)
test-integration/schedulecommit/client/src/schedule_commit_context.rs (1)
  • ephem_blockhash (282-284)
test-integration/test-tools/src/integration_test_context.rs (1)
  • try_get_latest_blockhash_ephem (1085-1087)
🔇 Additional comments (19)
.github/actions/setup-build-env/action.yml (1)

30-37: The addition of libclang-dev is necessary and correctly placed.

RocksDB is a workspace dependency that uses rocksdb-sys for C bindings, which requires libclang-dev headers to compile successfully. The Cargo.toml explicitly references rocksdb-sys and includes a comment about build compatibility. This dependency addition aligns with the recent RocksDB patch (0.23.0) and is not optional—it's required for the build to succeed on Linux.

magicblock-ledger/Cargo.toml (1)

33-33: No issues found with rocksdb workspace dependency reference.

The rocksdb dependency in magicblock-ledger correctly uses workspace = true. The root Cargo.toml intentionally overrides the workspace.dependencies.rocksdb with a git source (parent commit d4e9e16 of rocksdb 0.23.0) to resolve Solana version conflicts. This override is documented and marked for removal once Solana is upgraded to 2.3. The inline features declaration in magicblock-ledger matches the workspace configuration.

Cargo.toml (2)

190-193: Verify solana-svm revision 3e9456ec4 for compatibility and stability.

The solana-svm revision has been updated to 3e9456ec4, which is currently associated with PR 10 in the magicblock-svm repository. Confirm that this commit is stable and does not introduce breaking changes to the magicblock-svm fork or dependent crates in the workspace.


195-212: Rocksdb version mismatch is intentional but pending resolution.

The workspace declares rocksdb 0.22.0 but patches it to git rev d4e9e16 (a parent commit of 0.23.0) specifically to avoid linker conflicts with solana dependencies. Only magicblock-ledger directly uses rocksdb in the workspace, and it correctly inherits the lz4 feature from the workspace dependency.

The configuration is documented and intentional. However, the TODO to remove this patch upon solana 2.3 upgrade should reference a tracked issue or sprint plan for visibility and accountability.

magicblock-processor/src/executor/mod.rs (1)

242-252: Clarify ForkGraph::relationship direction and forkless assumption

The linear ordering (a < bAncestor, a > bDescendant, a == bEqual) looks sensible for a forkless chain, but correctness depends on how ForkGraph::relationship(a, b) defines the relation (i.e., “relation of a to b” vs the inverse). Please double‑check this against solana_program_runtime::loaded_programs::ForkGraph/BlockRelation docs and confirm that:

  • the direction (a vs b) matches Solana’s expectation, and
  • assuming a strictly linear, forkless slot sequence is acceptable for all current uses of SimpleForkGraph (e.g., no future support for reorgs/forks relying on this).
programs/magicblock/src/magicblock_processor.rs (1)

35-81: Noop arm correctly wired as a pure no-op

The new Noop(_) => Ok(()) arm cleanly handles the added enum variant without touching accounts or altering existing flows. This is a safe, backwards-compatible extension of the instruction dispatcher.

programs/magicblock/src/schedule_task/process_schedule_task.rs (1)

155-164: Tests now use shared Noop helper with unchanged semantics

Switching create_simple_ix to InstructionUtils::noop_instruction(0) preserves the “no accounts, no signers” behavior of the simple test instruction while centralizing Noop construction. This keeps the schedule‑task tests aligned with the on‑chain validation invariants (interval, iterations, non‑empty instructions) that the scheduler service relies on.

Based on learnings, this keeps validation where it belongs in the Magic program.

programs/magicblock/src/utils/instruction_utils.rs (1)

282-291: Noop helper is correctly scoped and implemented

InstructionUtils::noop_instruction cleanly wraps MagicBlockInstruction::Noop(data) with the program’s ID and no account metas, providing a single canonical way to build MagicBlock no-op instructions for tests and callers.

test-integration/test-task-scheduler/tests/test_schedule_error.rs (1)

12-12: Use ephem blockhash helper instead of NOOP helper

Importing setup_validator/create_delegated_counter and switching to ctx.try_get_latest_blockhash_ephem() is consistent with the new pattern across tests and removes the NOOP dependency without changing the test’s semantics.

Also applies to: 31-32

test-integration/test-task-scheduler/src/lib.rs (1)

29-30: solana_sdk import now matches actual usage

Trimming the solana_sdk import list down to the types used in this module is correct and keeps the dependency surface clean.

test-integration/test-task-scheduler/tests/test_unauthorized_reschedule.rs (1)

11-11: Align unauthorized-reschedule test with shared helpers and ephem blockhash API

Using setup_validator/create_delegated_counter plus ctx.try_get_latest_blockhash_ephem() standardizes setup and ephem blockhash retrieval across the suite while preserving the unauthorized-reschedule behavior being asserted here.

Also applies to: 35-36

test-integration/test-task-scheduler/tests/test_cancel_ongoing_task.rs (1)

12-12: Switch cancel-ongoing-task test to ctx.try_get_latest_blockhash_ephem

The new import and use of ctx.try_get_latest_blockhash_ephem() remove the NOOP transaction dependency while keeping the test’s scheduling and cancellation behavior intact.

Also applies to: 30-31

test-integration/test-task-scheduler/tests/test_reschedule_task.rs (1)

12-12: Use shared helpers and ephem blockhash helper in reschedule test

The refactor to setup_validator/create_delegated_counter and ctx.try_get_latest_blockhash_ephem() simplifies setup and keeps the reschedule assertions unchanged.

Also applies to: 30-31

test-integration/test-task-scheduler/tests/test_schedule_task_signed.rs (1)

10-10: Standardize signed-schedule test on ephem blockhash helper

Using setup_validator/create_delegated_counter and ctx.try_get_latest_blockhash_ephem() matches the rest of the suite and doesn’t change the expected MissingRequiredSignature behavior.

Also applies to: 25-26

test-integration/test-task-scheduler/tests/test_schedule_task.rs (1)

12-12: Migrate schedule-task test to shared setup and ephem blockhash API

The new helper import and ctx.try_get_latest_blockhash_ephem() usage are consistent with other tests and keep the end-to-end scheduling/cancellation and DB checks intact.

Also applies to: 30-31

test-integration/test-task-scheduler/tests/test_scheduled_commits.rs (1)

10-10: Use shared helpers and ephem blockhash helper in scheduled-commits test

The import update and ctx.try_get_latest_blockhash_ephem() call are consistent with the rest of the suite and keep the test logic straightforward.

Also applies to: 25-26

magicblock-processor/src/scheduler.rs (1)

142-152: Verify prune second parameter and confirm latest_root_slot redundancy

The locking consolidation is good, but the hardcoded 0 passed to cache.prune(root, 0) needs verification. LatestBlock contains clock: Clock, which has an epoch field — you likely need to pass self.latest_block.load().clock.epoch instead of 0 as the second argument to match the actual epoch of the block being processed.

Additionally, check your local solana-program-runtime v2.2.1 to confirm whether ProgramCache::prune updates latest_root_slot internally. If it does, the explicit cache.latest_root_slot = root; assignment is redundant. If not, add a comment explaining why the manual assignment is necessary to prevent future cleanup.

magicblock-task-scheduler/src/service.rs (2)

52-55: Boxing recoverable errors is reasonable and run‑loop handling remains consistent

Changing ProcessingOutcome::Recoverable to carry Box<TaskSchedulerError> and wrapping errors in process_request preserves the previous control flow while avoiding copies of potentially large error values. The run loop’s match on ProcessingOutcome still cleanly distinguishes recoverable vs fatal paths.

No functional issues spotted here.

Also applies to: 123-165, 260-283


301-321: Noop prefix for transaction uniqueness with AtomicU64 is sound

Using InstructionUtils::noop_instruction(self.tx_counter.fetch_add(1, Ordering::Relaxed)) to prepend a unique noop instruction achieves per‑tx uniqueness without affecting task instructions. Given the scheduler is confined to a single Tokio task (per the SAFETY comment), AtomicU64 with relaxed ordering is sufficient here.

@Dodecahedr0x Dodecahedr0x force-pushed the dode/schedule-with-rpc branch from ff66c7b to 1bb3bb5 Compare December 8, 2025 08:52
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
magicblock-api/src/magic_validator.rs (1)

279-297: Consider passing a higher‑level config handle instead of a raw RPC URL String

TaskSchedulerService::new now takes config.listen.http() as a String, which leaks knowledge of how the validator constructs its local RPC endpoint into the scheduler API. Long‑term, you might want to pass either config.listen (BindAddress) or a small TaskSchedulerRpcConfig struct and let the scheduler decide how to materialize the client URL, to reduce coupling between layers.

magicblock-task-scheduler/src/service.rs (1)

57-62: Update unsafe Send/Sync comment to reflect current fields

The safety comment still names TransactionSchedulerHandle, but the struct now holds an RpcClient instead. For future maintainers reviewing the unsafe Send/Sync impls, please update the comment to list the current fields (including RpcClient) so the justification matches the actual struct layout.

♻️ Duplicate comments (1)
magicblock-task-scheduler/src/service.rs (1)

301-329: Use the Signature returned by RpcClient::send_transaction and make RPC error mapping explicit

process_transaction derives the signature from tx.signatures[0] and ignores the Signature returned by send_transaction, while relying on map_err(Box::new)? plus the #[from] Box<...::Error> on TaskSchedulerError::Rpc. This duplicates the source of truth for the signature and hides the error mapping behind an extra boxing step.

You can simplify and make this clearer by using the returned signature and constructing the error variant directly:

-        let sig = tx.signatures[0];
-        self.rpc_client
-            .send_transaction(&tx)
-            .await
-            .map_err(Box::new)?;
-        Ok(sig)
+        self.rpc_client
+            .send_transaction(&tx)
+            .await
+            .map_err(|e| TaskSchedulerError::Rpc(Box::new(e)))

This uses the actual RPC response signature and documents the error conversion in one place.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ff66c7b and 1bb3bb5.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • test-integration/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • magicblock-api/src/magic_validator.rs (1 hunks)
  • magicblock-config/src/types/network.rs (1 hunks)
  • magicblock-task-scheduler/Cargo.toml (1 hunks)
  • magicblock-task-scheduler/src/db.rs (13 hunks)
  • magicblock-task-scheduler/src/errors.rs (1 hunks)
  • magicblock-task-scheduler/src/service.rs (8 hunks)
  • magicblock-task-scheduler/tests/service.rs (0 hunks)
  • test-integration/programs/schedulecommit/src/api.rs (1 hunks)
💤 Files with no reviewable changes (1)
  • magicblock-task-scheduler/tests/service.rs
🧰 Additional context used
🧠 Learnings (20)
📓 Common learnings
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: test-kit/src/lib.rs:275-0
Timestamp: 2025-11-07T13:09:52.253Z
Learning: In test-kit, the transaction scheduler in ExecutionTestEnv is not expected to shut down during tests. Therefore, using `.unwrap()` in test helper methods like `schedule_transaction` is acceptable and will not cause issues in the test environment.
📚 Learning: 2025-11-24T14:21:00.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: Cargo.toml:58-58
Timestamp: 2025-11-24T14:21:00.996Z
Learning: In the magicblock-validator codebase, magicblock-api/Cargo.toml intentionally uses borsh = "1.5.3" (instead of the workspace version 0.10.4) because it needs to deserialize types from the magic-domain-program external dependency, which requires borsh 1.5.x compatibility. This is an intentional exception for interoperability with the magic domain program.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
📚 Learning: 2025-11-12T09:46:27.553Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
  • magicblock-task-scheduler/src/errors.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-task-scheduler/src/db.rs
📚 Learning: 2025-11-07T18:19:48.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: test-integration/programs/schedulecommit/Cargo.toml:19-20
Timestamp: 2025-11-07T18:19:48.996Z
Learning: In Solana programs (crates depending on solana-program), the empty feature flags `custom-heap = []` and `custom-panic = []` are standard declarations required to avoid compiler warnings. These should not be flagged as unused features in Cargo.toml files for Solana program crates.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
📚 Learning: 2025-11-24T08:45:11.164Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 675
File: Cargo.toml:145-145
Timestamp: 2025-11-24T08:45:11.164Z
Learning: The reqwest dependency version 0.11 is intentionally used in the magicblock-validator project to maintain compatibility with the Solana client dependencies.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
📚 Learning: 2025-10-28T13:15:42.706Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 596
File: magicblock-processor/src/scheduler.rs:1-1
Timestamp: 2025-10-28T13:15:42.706Z
Learning: In magicblock-processor, transaction indexes were always set to 0 even before the changes in PR #596. The proper transaction indexing within slots will be addressed during the planned ledger rewrite.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
  • magicblock-config/src/types/network.rs
  • test-integration/programs/schedulecommit/src/api.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-10-21T13:06:38.900Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/http/get_program_accounts.rs:17-25
Timestamp: 2025-10-21T13:06:38.900Z
Learning: The magicblock validator does not support ledger forking, so commitment-based state queries (processed/confirmed/finalized) are not applicable. RPC methods can safely ignore commitment and minContextSlot parameters from Solana RPC config objects.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
📚 Learning: 2025-10-26T16:54:39.084Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 587
File: test-manual/Cargo.toml:0-0
Timestamp: 2025-10-26T16:54:39.084Z
Learning: In the magicblock-validator repository, use git branch references (not commit hashes or tags) for the helius-laserstream dependency to allow automatic updates when the branch is pushed to.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
📚 Learning: 2025-11-21T11:03:26.756Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 664
File: magicblock-chainlink/src/testing/mod.rs:342-370
Timestamp: 2025-11-21T11:03:26.756Z
Learning: In the magicblock-validator codebase, avoid leaving review comments that merely acknowledge code is correct or well-structured when there is no actionable suggestion, improvement, or issue to flag. Only comment when there is something specific to recommend, fix, or clarify.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
📚 Learning: 2025-12-03T09:33:48.707Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: test-integration/test-committor-service/tests/test_ix_commit_local.rs:867-881
Timestamp: 2025-12-03T09:33:48.707Z
Learning: Repo: magicblock-labs/magicblock-validator PR: 639
Context: test-integration/test-committor-service/tests/test_ix_commit_local.rs (ix_commit_local)
Learning: The PhotonIndexer used for compressed account fetches (get_compressed_account) has built‑in retry logic (defaults to ~10 attempts), so tests should not add separate retry loops around compressed fetches unless there’s a specific need.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
  • test-integration/programs/schedulecommit/src/api.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-20T08:57:07.217Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 650
File: magicblock-chainlink/src/submux/subscription_task.rs:13-99
Timestamp: 2025-11-20T08:57:07.217Z
Learning: In the magicblock-validator repository, avoid posting review comments that merely confirm code is correct or matches intended behavior without providing actionable feedback, suggestions for improvement, or identifying potential issues. Such confirmatory comments are considered unhelpful noise by the maintainers.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
📚 Learning: 2025-11-04T13:22:38.811Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-aperture/src/requests/http/get_fee_for_message.rs:25-31
Timestamp: 2025-11-04T13:22:38.811Z
Learning: In magicblock-aperture, request size validation (including limits on message size) is enforced at the request ingestion layer, before handlers like get_fee_for_message are invoked. Therefore, handlers do not need additional size guards on decoded data.

Applied to files:

  • magicblock-task-scheduler/Cargo.toml
📚 Learning: 2025-12-03T09:36:01.527Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: magicblock-chainlink/src/remote_account_provider/mod.rs:1350-1353
Timestamp: 2025-12-03T09:36:01.527Z
Learning: Repo: magicblock-labs/magicblock-validator
File: magicblock-chainlink/src/remote_account_provider/mod.rs
Context: consolidate_fetched_remote_accounts
Learning: For unexpected result counts (>2), the project prefers logging an error and returning an empty Vec over panicking; acceptable during development per maintainer (Dodecahedr0x).

Applied to files:

  • magicblock-config/src/types/network.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-07T14:20:31.457Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs:457-495
Timestamp: 2025-11-07T14:20:31.457Z
Learning: In magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs, the unsubscribe closure returned by PubSubConnection::account_subscribe(...) resolves to () (unit), not a Result. Downstream code should not attempt to inspect an unsubscribe result and can optionally wrap it in a timeout to guard against hangs.

Applied to files:

  • magicblock-config/src/types/network.rs
  • magicblock-task-scheduler/src/errors.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-04T10:53:50.922Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:110-122
Timestamp: 2025-11-04T10:53:50.922Z
Learning: In magicblock-processor, the TransactionScheduler runs in a single, dedicated thread and will always remain single-threaded. The `next_transaction_id()` function in scheduler/locks.rs uses `unsafe static mut` which is safe given this architectural guarantee.

Applied to files:

  • magicblock-api/src/magic_validator.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-task-scheduler/src/db.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.

Applied to files:

  • magicblock-api/src/magic_validator.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-task-scheduler/src/db.rs
📚 Learning: 2025-11-07T13:09:52.253Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: test-kit/src/lib.rs:275-0
Timestamp: 2025-11-07T13:09:52.253Z
Learning: In test-kit, the transaction scheduler in ExecutionTestEnv is not expected to shut down during tests. Therefore, using `.unwrap()` in test helper methods like `schedule_transaction` is acceptable and will not cause issues in the test environment.

Applied to files:

  • magicblock-api/src/magic_validator.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-task-scheduler/src/db.rs
📚 Learning: 2025-11-13T09:38:43.804Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:64-102
Timestamp: 2025-11-13T09:38:43.804Z
Learning: In magicblock-processor's TransactionScheduler (scheduler/mod.rs line 59), the executor count is clamped to MAX_SVM_EXECUTORS (63) at initialization time, and executor IDs are assigned sequentially from 0 to count-1. This architectural guarantee ensures that executor IDs used in the bitmask-based AccountLock (scheduler/locks.rs) will always be within valid bounds for bit shifting operations, making runtime bounds checks unnecessary.

Applied to files:

  • magicblock-api/src/magic_validator.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
🧬 Code graph analysis (3)
magicblock-task-scheduler/src/errors.rs (3)
magicblock-committor-service/src/transaction_preparator/delivery_preparator.rs (3)
  • from (499-501)
  • from (534-538)
  • from (560-562)
magicblock-api/src/errors.rs (6)
  • from (104-106)
  • from (110-112)
  • from (116-118)
  • from (122-124)
  • from (130-134)
  • from (138-140)
magicblock-chainlink/src/remote_account_provider/errors.rs (1)
  • from (95-97)
magicblock-task-scheduler/src/service.rs (1)
magicblock-core/src/link.rs (1)
  • link (60-89)
magicblock-task-scheduler/src/db.rs (1)
magicblock-task-scheduler/src/service.rs (1)
  • new (64-97)
🔇 Additional comments (1)
magicblock-task-scheduler/src/db.rs (1)

68-85: Adding created_at/updated_at without migration will break existing scheduler databases

The tasks table now includes created_at and updated_at as INTEGER NOT NULL, and insert_task unconditionally inserts into these columns. However, CREATE TABLE IF NOT EXISTS does not alter an existing table, so any pre-existing task_scheduler.sqlite created before this change will not have those columns. On upgrade, INSERT OR REPLACE INTO tasks (...) will fail with "no such column: created_at/updated_at", breaking task scheduling (and possibly validator startup).

You'll need either:

  • a schema migration path (e.g., detect missing columns and ALTER TABLE to add them with sensible defaults), or
  • a deliberate reset strategy (e.g., force config.task_scheduler.reset = true for this release and clearly document that tasks DB will be wiped).

Right now this is a silent migration hazard.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
magicblock-task-scheduler/src/service.rs (2)

194-223: Consider retry logic for transient RPC failures.

The current implementation removes and logs failed tasks (lines 270-271), which is reasonable. However, for improved resilience, consider distinguishing between transient network errors (which could be retried) versus permanent failures (invalid transaction). This could be implemented by:

  1. Inspecting the error type from send_transaction
  2. Implementing a bounded retry with backoff for retriable errors
  3. Only marking the task as failed after retry exhaustion

This is optional and depends on the reliability requirements for scheduled tasks.


57-62: Update the safety comment to reflect the actual struct fields and verify necessity of unsafe impls.

The safety comment lists TransactionSchedulerHandle (line 58) which is not a field in the struct, and omits RpcClient which is. Update the comment to accurately list: SchedulerDatabase, RpcClient, ScheduledTasksRx, LatestBlock, DelayQueue, HashMap, AtomicU64, CancellationToken. If all these fields are confirmed to be Send+Sync, consider whether the unsafe impls can be removed and let the compiler auto-derive these traits, or document the specific reason they remain necessary.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1bb3bb5 and d0f7dec.

📒 Files selected for processing (1)
  • magicblock-task-scheduler/src/service.rs (8 hunks)
🧰 Additional context used
🧠 Learnings (16)
📓 Common learnings
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.
📚 Learning: 2025-11-04T10:53:50.922Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:110-122
Timestamp: 2025-11-04T10:53:50.922Z
Learning: In magicblock-processor, the TransactionScheduler runs in a single, dedicated thread and will always remain single-threaded. The `next_transaction_id()` function in scheduler/locks.rs uses `unsafe static mut` which is safe given this architectural guarantee.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-12T09:46:27.553Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-12-03T09:33:48.707Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: test-integration/test-committor-service/tests/test_ix_commit_local.rs:867-881
Timestamp: 2025-12-03T09:33:48.707Z
Learning: Repo: magicblock-labs/magicblock-validator PR: 639
Context: test-integration/test-committor-service/tests/test_ix_commit_local.rs (ix_commit_local)
Learning: The PhotonIndexer used for compressed account fetches (get_compressed_account) has built‑in retry logic (defaults to ~10 attempts), so tests should not add separate retry loops around compressed fetches unless there’s a specific need.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-07T14:20:31.457Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs:457-495
Timestamp: 2025-11-07T14:20:31.457Z
Learning: In magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs, the unsubscribe closure returned by PubSubConnection::account_subscribe(...) resolves to () (unit), not a Result. Downstream code should not attempt to inspect an unsubscribe result and can optionally wrap it in a timeout to guard against hangs.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-12-03T09:36:01.527Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: magicblock-chainlink/src/remote_account_provider/mod.rs:1350-1353
Timestamp: 2025-12-03T09:36:01.527Z
Learning: Repo: magicblock-labs/magicblock-validator
File: magicblock-chainlink/src/remote_account_provider/mod.rs
Context: consolidate_fetched_remote_accounts
Learning: For unexpected result counts (>2), the project prefers logging an error and returning an empty Vec over panicking; acceptable during development per maintainer (Dodecahedr0x).

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-19T09:34:37.917Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: test-integration/test-chainlink/tests/ix_remote_account_provider.rs:62-63
Timestamp: 2025-11-19T09:34:37.917Z
Learning: In test-integration/test-chainlink/tests/ix_remote_account_provider.rs and similar test files, the `_fwd_rx` receiver returned by `init_remote_account_provider()` is intentionally kept alive (but unused) to prevent "receiver dropped" errors on the sender side. The pattern `let (remote_account_provider, _fwd_rx) = init_remote_account_provider().await;` should NOT be changed to `let (remote_account_provider, _) = ...` because dropping the receiver would cause send() operations to fail.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-07T13:09:52.253Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: test-kit/src/lib.rs:275-0
Timestamp: 2025-11-07T13:09:52.253Z
Learning: In test-kit, the transaction scheduler in ExecutionTestEnv is not expected to shut down during tests. Therefore, using `.unwrap()` in test helper methods like `schedule_transaction` is acceptable and will not cause issues in the test environment.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-12-01T16:02:05.367Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 703
File: magicblock-chainlink/src/submux/mod.rs:652-654
Timestamp: 2025-12-01T16:02:05.367Z
Learning: In magicblock-chainlink/src/submux/mod.rs, the subscribe_program method intentionally adds program_id to program_subs before attempting the subscription. This ensures that even if the initial subscription fails or only partially succeeds across clients, the reconnection logic will retry the subscription. This is a deliberate design pattern for resilience in the multi-client architecture and should not be "fixed" to remove entries on failure.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-10-28T13:15:42.706Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 596
File: magicblock-processor/src/scheduler.rs:1-1
Timestamp: 2025-10-28T13:15:42.706Z
Learning: In magicblock-processor, transaction indexes were always set to 0 even before the changes in PR #596. The proper transaction indexing within slots will be addressed during the planned ledger rewrite.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-20T08:57:07.217Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 650
File: magicblock-chainlink/src/submux/subscription_task.rs:13-99
Timestamp: 2025-11-20T08:57:07.217Z
Learning: In the magicblock-validator repository, avoid posting review comments that merely confirm code is correct or matches intended behavior without providing actionable feedback, suggestions for improvement, or identifying potential issues. Such confirmatory comments are considered unhelpful noise by the maintainers.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-21T11:03:26.756Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 664
File: magicblock-chainlink/src/testing/mod.rs:342-370
Timestamp: 2025-11-21T11:03:26.756Z
Learning: In the magicblock-validator codebase, avoid leaving review comments that merely acknowledge code is correct or well-structured when there is no actionable suggestion, improvement, or issue to flag. Only comment when there is something specific to recommend, fix, or clarify.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-13T09:38:43.804Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:64-102
Timestamp: 2025-11-13T09:38:43.804Z
Learning: In magicblock-processor's TransactionScheduler (scheduler/mod.rs line 59), the executor count is clamped to MAX_SVM_EXECUTORS (63) at initialization time, and executor IDs are assigned sequentially from 0 to count-1. This architectural guarantee ensures that executor IDs used in the bitmask-based AccountLock (scheduler/locks.rs) will always be within valid bounds for bit shifting operations, making runtime bounds checks unnecessary.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
🧬 Code graph analysis (1)
magicblock-task-scheduler/src/service.rs (1)
magicblock-core/src/link.rs (1)
  • link (60-89)
🔇 Additional comments (4)
magicblock-task-scheduler/src/service.rs (4)

17-21: LGTM!

Import changes correctly switch to granular Solana crates and use the nonblocking RpcClient for async transaction submission.


36-37: LGTM!

Field replacement and error boxing changes align with the PR objective to route transactions through RPC for proper Chainlink integration.

Also applies to: 54-54


141-141: LGTM!

Error boxing is consistent in both branches and matches the updated ProcessingOutcome::Recoverable(Box<TaskSchedulerError>) signature.

Also applies to: 159-159


323-327: LGTM!

The implementation correctly uses the signature returned by send_transaction and properly boxes the error for conversion.

@Dodecahedr0x Dodecahedr0x force-pushed the dode/schedule-with-rpc branch from d0f7dec to f4cd087 Compare December 8, 2025 10:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
magicblock-ledger/src/store/api.rs (1)

1268-1276: Explicit flush() call removed from shutdown without compensating at higher level.

The ledger's shutdown() method no longer explicitly flushes data before calling cancel_all_background_work(wait). While the higher-level shutdown sequence in magic_validator.rs flushes accountsdb, the ledger itself is not flushed. RocksDB's cancel_all_background_work(wait=true) waits for background operations (compaction, etc.) to complete but does not guarantee flushing of memtables to disk. This risks data loss if shutdown is interrupted or incomplete. Call self.flush()? before cancel_all_background_work(wait) in the shutdown method to ensure durability.

♻️ Duplicate comments (2)
magicblock-api/src/magic_validator.rs (1)

295-305: LGTM! TaskSchedulerService initialization updated.

The constructor now correctly receives config.listen.http() for RPC URL, addressing the previous review feedback about exposing internal details.

magicblock-task-scheduler/src/service.rs (1)

87-89: Consider explicit timeout configuration for production resilience.

RpcClient::new(rpc_url) uses the default 30-second timeout. For production environments with varying network conditions, consider using RpcClient::new_with_timeout(rpc_url, timeout) to allow configurable timeout values.

🧹 Nitpick comments (17)
magicblock-committor-program/src/state/chunks.rs (1)

18-20: Consider using the actual constant name for consistency.

The doc example uses BIT_FIELD_SIZE while the implementation uses BITS_PER_BYTE (line 7). Using the same name would help readers connect the example to the actual code.

🔎 Suggested change
     /// ```rust
-    /// # const BIT_FIELD_SIZE: usize = 8;
+    /// # const BITS_PER_BYTE: usize = 8;
     /// # let bits = vec![0u8; 1];
-    /// let capacity = bits.len() * BIT_FIELD_SIZE;
+    /// let capacity = bits.len() * BITS_PER_BYTE;
     /// ```
magicblock-aperture/src/server/websocket/connection.rs (1)

105-111: Correct the misleading comment about close frame handling.

The comment on line 108 states "without close frame," but a close frame is actually sent after the loop exits (lines 178-181). The comment should be updated to reflect the actual behavior.

🔎 Suggested fix
                // Prioritize fast system shutdown
                biased;

-               // 0. We force shutdown the connection, without close frame
+               // 0. Force shutdown on cancellation signal (close frame sent after loop exit)
                _ = self.cancel.cancelled() => break,
-
README.md (2)

74-74: Clarify remote cluster configuration.

The example shows both HTTP and WSS URLs. Add guidance on when each URL type is used (e.g., HTTP for RPC calls, WSS for subscriptions).

🔎 Proposed enhancement
-# Example: Sync with Solana Devnet
-remotes = ["https://api.devnet.solana.com", "wss://api.devnet.solana.com"]
+# Example: Sync with Solana Devnet
+# Note: HTTP URLs are used for RPC calls, WSS URLs for subscriptions
+remotes = ["https://api.devnet.solana.com", "wss://api.devnet.solana.com"]

105-105: Specify Docker image version tag.

The Docker command uses an implicit 'latest' tag, which is not recommended for production deployments. Specify an explicit version.

🔎 Proposed improvement
-docker run -p 8899:8899 -p 8900:8900 magicblocklabs/validator
+docker run -p 8899:8899 -p 8900:8900 magicblocklabs/validator:latest

Or use a specific release version:

docker run -p 8899:8899 -p 8900:8900 magicblocklabs/validator:v0.1.0
magicblock-aperture/src/requests/http/get_blocks_with_limit.rs (1)

23-24: Off-by-one fix correctly includes the latest block.

The change from block_height() to block_height() + 1 fixes an off-by-one error. Previously, the exclusive range (start_slot..end_slot) would exclude the block at block_height(), preventing users from retrieving the latest block. The new logic correctly allows the latest block to be included in results.

Consider updating the comment at line 23 to clarify the inclusive behavior:

-        // Calculate the end slot, ensuring it does not exceed the latest block height.
+        // Calculate the end slot, allowing up to and including the latest block height.
docs/GOVERNANCE.md (2)

48-48: Use standard capitalization for GitHub references.

The file path .github/CODEOWNERS is correct (lowercase directory). If the document refers to "GitHub" as the platform/service name elsewhere, ensure it uses the standard capitalization "GitHub".


95-95: Remove redundancy: "consult with" → "consult".

The phrasing can be simplified for conciseness without loss of clarity.

🔎 Proposed fix
- Before implementing significant changes, the assignee must consult with the CO of the affected crate(s) to align on the proposed design and impact.
+ Before implementing significant changes, the assignee must consult the CO of the affected crate(s) to align on the proposed design and impact.
.github/ISSUE_TEMPLATE/feature.yml (1)

1-16: LGTM!

The feature request template provides clear structure with Problem/Proposal/Acceptance criteria sections. The concise format encourages focused feature discussions.

Optional: Consider adding supplementary fields

You might consider adding optional fields for richer context, such as:

     validations:
       required: true
+
+  - type: textarea
+    id: alternatives
+    attributes:
+      label: Alternatives Considered
+      description: Other approaches you've considered (optional).
+      placeholder: "Alternative solutions..."
+    validations:
+      required: false
+
+  - type: textarea
+    id: context
+    attributes:
+      label: Additional Context
+      description: Use cases, screenshots, examples, etc. (optional).
+      placeholder: "Context..."
+    validations:
+      required: false

This is entirely optional—the current template is already effective.

.coderabbit.yaml (1)

34-44: Consider keeping some pre-merge checks in warning mode.

All pre-merge checks are now disabled (mode: off), which removes automated quality gates. While this aligns with the stated goal of keeping friction low, completely disabling these checks means:

  • No automated reminders about missing docstrings
  • No automated validation of PR titles/descriptions
  • No assessment of whether changes address linked issues

If the goal is to reduce blocking friction while maintaining visibility, consider setting these to mode: warning instead of off. Warning mode provides feedback without blocking merges.

Alternative: Use warning mode for non-blocking feedback
   pre_merge_checks:
     docstrings:
-      mode: off
+      mode: warning
     title:
-      mode: off
+      mode: warning
     description:
-      mode: off
+      mode: warning
     issue_assessment:
-      mode: off
+      mode: warning
magicblock-processor/src/scheduler/locks.rs (1)

62-63: Minor: Fix typos in doc comments.

"exeucotor" → "executor"

🔎 Proposed fix
-    /// The return Err value corresponds to the exeucotor ID, holding the lock
+    /// The return Err value corresponds to the executor ID holding the lock
-    /// The return Err value corresponds to the exeucotor ID, holding the lock
+    /// The return Err value corresponds to the executor ID holding the lock

Also applies to: 79-79

magicblock-chainlink/src/remote_account_provider/mod.rs (1)

1054-1064: Consider using the retry! macro for consistency.

The timeout handler duplicates retry logic (decrement, check, sleep, continue) that's already encapsulated in the retry! macro. Consider using the macro for consistency and to avoid potential maintenance drift.

🔎 Proposed fix
                     Err(_) => {
-                        warn!("RPC call timeout. Retrying...");
-                        remaining_retries -= 1;
-                        if remaining_retries == 0 {
-                            let err_msg = format!("Max retries {MAX_RETRIES} reached, giving up on fetching accounts: {pubkeys:?}");
-                            notify_error(&err_msg);
-                            return;
-                        }
-                        tokio::time::sleep(Duration::from_millis(400)).await;
-                        continue;
+                        retry!("RPC call timeout. Retrying...");
                     }
config.example.toml (1)

34-58: LGTM! Comprehensive documentation for remotes configuration.

The migration from remote to remotes is well-documented with clear examples and explanation of supported URL schemes and aliases. The documentation effectively guides users through the new multi-remote configuration.

However, consider clarifying that gRPC URLs do not support aliases (mainnet/devnet/testnet/localhost) and must use explicit URLs. Based on learnings, the resolve_url function passes gRPC URLs through as-is without alias resolution.

🔎 Suggested documentation enhancement
 # URL Aliases (resolved during parsing):
-# - "mainnet":   resolves to https://api.mainnet-beta.solana.com/
-# - "devnet":    resolves to https://api.devnet.solana.com/
-# - "testnet":   resolves to https://api.testnet.solana.com/
-# - "localhost": resolves to http://localhost:8899/ (only for http/https schemes)
+# - "mainnet":   resolves to https://api.mainnet-beta.solana.com/ (HTTP/WebSocket only)
+# - "devnet":    resolves to https://api.devnet.solana.com/ (HTTP/WebSocket only)
+# - "testnet":   resolves to https://api.testnet.solana.com/ (HTTP/WebSocket only)
+# - "localhost": resolves to http://localhost:8899/ (HTTP/WebSocket only)
+# Note: gRPC URLs do not support aliases and must be specified explicitly.
magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs (1)

606-627: LGTM with minor optimization opportunity.

The update handling logic correctly:

  1. Parses the account pubkey from the response
  2. Only forwards updates for accounts that are directly subscribed
  3. Tracks metrics per client

The client_id.to_string() allocation on every update is a minor overhead. Consider caching the string representation if this becomes a hot path.

🔎 Optional: Cache client_id string to avoid repeated allocations

Pre-compute the client ID string and pass it into the spawned task:

+        let client_id_str = client_id.to_string();
         tokio::spawn(async move {
             // ...
                                      inc_program_subscription_account_updates(
-                                         &client_id.to_string(),
+                                         &client_id_str,
                                      );
test-integration/test-tools/src/toml_to_args.rs (1)

25-44: Fallback returns URL without scheme when parsing fails.

When Remote::from_str(&full_url) fails on line 38, the fallback on line 42 returns self.url.clone() which lacks the scheme prefix (e.g., http://). This could cause downstream issues since the caller expects a full URL with scheme.

Consider returning full_url instead of self.url in the error case:

🔎 Proposed fix
         // Parse the full URL into a Remote instance to resolve aliases
         if let Ok(remote) = Remote::from_str(&full_url) {
             remote.url_str().to_string()
         } else {
             // If parsing fails, return the raw URL
-            self.url.clone()
+            full_url
         }
magicblock-config/src/types/network.rs (2)

60-82: Consider using a more semantically appropriate error for unknown schemes.

The InvalidDomainCharacter error at line 78 is returned for unsupported URL schemes, but this is semantically misleading since the actual issue is an unrecognized scheme, not an invalid domain character. Unfortunately, url::ParseError doesn't have an InvalidScheme variant.

This is acceptable as-is since url::ParseError has limited variants, but consider documenting this behavior or wrapping with a custom error type in the future if more granular error handling becomes necessary.


106-109: Port increment could overflow at 65535.

When port is 65535, port + 1 overflows to 0 (due to wrapping) which may produce unexpected behavior. While this is unlikely in practice (standard ports are well below this), consider adding a saturating operation or returning None for invalid port ranges.

🔎 Proposed defensive fix
         if let Some(port) = url.port() {
             // As per solana convention websocket port is one greater than http
-            let _ = url.set_port(Some(port + 1));
+            let _ = url.set_port(port.checked_add(1));
         }

Note: set_port(None) removes the port, which effectively uses the default port for the scheme. This is a reasonable fallback if the port would overflow.

magicblock-chainlink/src/chainlink/fetch_cloner.rs (1)

1258-1273: Add observability for timeout occurrences via metrics and tests.

The 5-second timeout prevents hanging on delegation record checks during account refresh decisions, which aligns with making the crank more reliable. On timeout, the code logs a warning and defaults to RefreshDecision::No. This pattern is consistent with the codebase's established error handling approach. Since accounts marked as undelegating are checked repeatedly, any temporary staleness from a timeout is bounded and will be resolved on the next iteration.

To improve observability and test coverage, consider:

  • Adding a metric to track timeout occurrences (the metrics infrastructure already exists in the codebase)
  • Adding a test that simulates slow delegation record fetches to verify timeout behavior is handled correctly
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc5634f and 97b3e25.

⛔ Files ignored due to path filters (3)
  • Cargo.lock is excluded by !**/*.lock
  • docs/bank-usage.svg is excluded by !**/*.svg
  • test-integration/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (97)
  • .coderabbit.yaml
  • .github/ISSUE_TEMPLATE/bug.yml
  • .github/ISSUE_TEMPLATE/config.yml
  • .github/ISSUE_TEMPLATE/docs.yml
  • .github/ISSUE_TEMPLATE/feature.yml
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/workflows/ci-fmt.yml
  • Cargo.toml
  • README.md
  • config.example.toml
  • docs/CODE_OF_CONDUCT.md
  • docs/CONTRIBUTING.md
  • docs/GOVERNANCE.md
  • docs/SECURITY.md
  • docs/central-scheduler.md
  • docs/features.md
  • docs/loading-existing-ledger.md
  • docs/memory-issue.md
  • docs/rpc.md
  • docs/runtime.md
  • docs/schedule-commit-flow.md
  • docs/send-transaction-service.md
  • magicblock-accounts/src/config.rs
  • magicblock-aperture/Cargo.toml
  • magicblock-aperture/src/requests/http/get_blocks_with_limit.rs
  • magicblock-aperture/src/requests/http/get_token_account_balance.rs
  • magicblock-aperture/src/requests/http/mocked.rs
  • magicblock-aperture/src/requests/http/request_airdrop.rs
  • magicblock-aperture/src/server/http/mod.rs
  • magicblock-aperture/src/server/websocket/connection.rs
  • magicblock-aperture/src/server/websocket/mod.rs
  • magicblock-aperture/src/tests.rs
  • magicblock-aperture/tests/mocked.rs
  • magicblock-aperture/tests/node.rs
  • magicblock-aperture/tests/setup.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-api/src/tickers.rs
  • magicblock-chainlink/src/chainlink/fetch_cloner.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • magicblock-chainlink/src/submux/mod.rs
  • magicblock-committor-program/src/state/chunks.rs
  • magicblock-committor-service/src/service.rs
  • magicblock-config/src/config/cli.rs
  • magicblock-config/src/consts.rs
  • magicblock-config/src/lib.rs
  • magicblock-config/src/tests.rs
  • magicblock-config/src/types/mod.rs
  • magicblock-config/src/types/network.rs
  • magicblock-core/src/link/transactions.rs
  • magicblock-ledger/Cargo.toml
  • magicblock-ledger/src/database/columns.rs
  • magicblock-ledger/src/ledger_truncator.rs
  • magicblock-ledger/src/store/api.rs
  • magicblock-metrics/src/metrics/mod.rs
  • magicblock-metrics/src/metrics/types.rs
  • magicblock-metrics/src/service.rs
  • magicblock-processor/Cargo.toml
  • magicblock-processor/src/executor/mod.rs
  • magicblock-processor/src/executor/processing.rs
  • magicblock-processor/src/lib.rs
  • magicblock-processor/src/scheduler.rs
  • magicblock-processor/src/scheduler/coordinator.rs
  • magicblock-processor/src/scheduler/locks.rs
  • magicblock-processor/src/scheduler/mod.rs
  • magicblock-processor/src/scheduler/tests.rs
  • magicblock-processor/tests/fees.rs
  • magicblock-processor/tests/scheduling.rs
  • magicblock-processor/tests/security.rs
  • magicblock-table-mania/src/manager.rs
  • magicblock-task-scheduler/README.md
  • magicblock-task-scheduler/src/service.rs
  • magicblock-validator/src/main.rs
  • test-integration/configs/api-conf.ephem.toml
  • test-integration/configs/chainlink-conf.devnet.toml
  • test-integration/configs/claim-fees-test.toml
  • test-integration/configs/cloning-conf.devnet.toml
  • test-integration/configs/cloning-conf.ephem.toml
  • test-integration/configs/committor-conf.devnet.toml
  • test-integration/configs/config-conf.devnet.toml
  • test-integration/configs/restore-ledger-conf.devnet.toml
  • test-integration/configs/schedule-task.devnet.toml
  • test-integration/configs/schedule-task.ephem.toml
  • test-integration/configs/schedulecommit-conf-fees.ephem.toml
  • test-integration/configs/schedulecommit-conf.devnet.toml
  • test-integration/configs/schedulecommit-conf.ephem.frequent-commits.toml
  • test-integration/configs/schedulecommit-conf.ephem.toml
  • test-integration/configs/validator-offline.devnet.toml
  • test-integration/test-config/src/lib.rs
  • test-integration/test-config/tests/auto_airdrop_feepayer.rs
  • test-integration/test-ledger-restore/src/lib.rs
  • test-integration/test-magicblock-api/src/lib.rs
  • test-integration/test-runner/bin/run_tests.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • test-integration/test-tools/src/toml_to_args.rs
  • test-integration/test-tools/src/validator.rs
  • test-kit/src/lib.rs
💤 Files with no reviewable changes (15)
  • .github/workflows/ci-fmt.yml
  • docs/send-transaction-service.md
  • test-integration/test-runner/bin/run_tests.rs
  • docs/loading-existing-ledger.md
  • magicblock-processor/src/lib.rs
  • magicblock-accounts/src/config.rs
  • docs/runtime.md
  • docs/central-scheduler.md
  • magicblock-processor/src/scheduler.rs
  • test-integration/test-tools/src/validator.rs
  • docs/rpc.md
  • docs/schedule-commit-flow.md
  • docs/memory-issue.md
  • test-integration/test-magicblock-api/src/lib.rs
  • docs/features.md
✅ Files skipped from review due to trivial changes (5)
  • magicblock-committor-service/src/service.rs
  • docs/SECURITY.md
  • magicblock-task-scheduler/README.md
  • .github/ISSUE_TEMPLATE/docs.yml
  • .github/PULL_REQUEST_TEMPLATE.md
🧰 Additional context used
🧠 Learnings (31)
📓 Common learnings
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.
📚 Learning: 2025-12-03T09:36:01.527Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: magicblock-chainlink/src/remote_account_provider/mod.rs:1350-1353
Timestamp: 2025-12-03T09:36:01.527Z
Learning: Repo: magicblock-labs/magicblock-validator
File: magicblock-chainlink/src/remote_account_provider/mod.rs
Context: consolidate_fetched_remote_accounts
Learning: For unexpected result counts (>2), the project prefers logging an error and returning an empty Vec over panicking; acceptable during development per maintainer (Dodecahedr0x).

Applied to files:

  • magicblock-aperture/src/requests/http/request_airdrop.rs
  • magicblock-api/src/tickers.rs
  • magicblock-aperture/src/requests/http/get_token_account_balance.rs
  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • test-integration/configs/cloning-conf.ephem.toml
  • magicblock-chainlink/src/chainlink/fetch_cloner.rs
  • magicblock-processor/src/executor/processing.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-processor/tests/scheduling.rs
  • test-integration/test-config/tests/auto_airdrop_feepayer.rs
  • magicblock-config/src/config/cli.rs
  • test-integration/test-config/src/lib.rs
  • magicblock-metrics/src/metrics/mod.rs
  • magicblock-config/src/lib.rs
  • magicblock-chainlink/src/submux/mod.rs
  • magicblock-task-scheduler/src/service.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • magicblock-aperture/tests/mocked.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-config/src/types/network.rs
  • test-integration/test-tools/src/toml_to_args.rs
  • magicblock-config/src/consts.rs
  • magicblock-config/src/tests.rs
  • test-integration/test-ledger-restore/src/lib.rs
  • magicblock-processor/tests/fees.rs
📚 Learning: 2025-12-03T09:33:48.707Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: test-integration/test-committor-service/tests/test_ix_commit_local.rs:867-881
Timestamp: 2025-12-03T09:33:48.707Z
Learning: Repo: magicblock-labs/magicblock-validator PR: 639
Context: test-integration/test-committor-service/tests/test_ix_commit_local.rs (ix_commit_local)
Learning: The PhotonIndexer used for compressed account fetches (get_compressed_account) has built‑in retry logic (defaults to ~10 attempts), so tests should not add separate retry loops around compressed fetches unless there’s a specific need.

Applied to files:

  • magicblock-aperture/src/requests/http/request_airdrop.rs
  • magicblock-aperture/src/tests.rs
  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • magicblock-chainlink/src/chainlink/fetch_cloner.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-processor/tests/scheduling.rs
  • test-integration/test-config/tests/auto_airdrop_feepayer.rs
  • magicblock-processor/src/scheduler/tests.rs
  • magicblock-aperture/tests/setup.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-aperture/tests/mocked.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-aperture/tests/node.rs
  • magicblock-processor/tests/fees.rs
  • Cargo.toml
📚 Learning: 2025-11-24T14:21:00.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: Cargo.toml:58-58
Timestamp: 2025-11-24T14:21:00.996Z
Learning: In the magicblock-validator codebase, magicblock-api/Cargo.toml intentionally uses borsh = "1.5.3" (instead of the workspace version 0.10.4) because it needs to deserialize types from the magic-domain-program external dependency, which requires borsh 1.5.x compatibility. This is an intentional exception for interoperability with the magic domain program.

Applied to files:

  • magicblock-processor/Cargo.toml
  • magicblock-ledger/Cargo.toml
  • magicblock-aperture/Cargo.toml
  • magicblock-config/src/types/mod.rs
  • Cargo.toml
📚 Learning: 2025-11-07T18:19:48.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: test-integration/programs/schedulecommit/Cargo.toml:19-20
Timestamp: 2025-11-07T18:19:48.996Z
Learning: In Solana programs (crates depending on solana-program), the empty feature flags `custom-heap = []` and `custom-panic = []` are standard declarations required to avoid compiler warnings. These should not be flagged as unused features in Cargo.toml files for Solana program crates.

Applied to files:

  • magicblock-processor/Cargo.toml
  • magicblock-ledger/Cargo.toml
  • Cargo.toml
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.

Applied to files:

  • magicblock-core/src/link/transactions.rs
  • magicblock-processor/src/executor/processing.rs
  • magicblock-processor/src/executor/mod.rs
  • magicblock-processor/tests/scheduling.rs
  • magicblock-processor/src/scheduler/tests.rs
  • magicblock-processor/src/scheduler/mod.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-processor/src/scheduler/locks.rs
  • magicblock-api/src/magic_validator.rs
  • test-kit/src/lib.rs
  • magicblock-processor/src/scheduler/coordinator.rs
📚 Learning: 2025-10-21T11:00:18.396Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/encoder.rs:176-187
Timestamp: 2025-10-21T11:00:18.396Z
Learning: In the magicblock validator, the current slot is always the root slot. The SlotEncoder in magicblock-aperture/src/encoder.rs correctly sets `root: slot` because there is no lag between current and root slots in this architecture.

Applied to files:

  • magicblock-aperture/src/requests/http/get_blocks_with_limit.rs
📚 Learning: 2025-11-19T09:34:37.917Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: test-integration/test-chainlink/tests/ix_remote_account_provider.rs:62-63
Timestamp: 2025-11-19T09:34:37.917Z
Learning: In test-integration/test-chainlink/tests/ix_remote_account_provider.rs and similar test files, the `_fwd_rx` receiver returned by `init_remote_account_provider()` is intentionally kept alive (but unused) to prevent "receiver dropped" errors on the sender side. The pattern `let (remote_account_provider, _fwd_rx) = init_remote_account_provider().await;` should NOT be changed to `let (remote_account_provider, _) = ...` because dropping the receiver would cause send() operations to fail.

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • magicblock-chainlink/src/chainlink/fetch_cloner.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • test-integration/test-config/tests/auto_airdrop_feepayer.rs
  • magicblock-processor/src/scheduler/tests.rs
  • magicblock-aperture/tests/setup.rs
  • magicblock-processor/src/scheduler/mod.rs
  • test-integration/test-config/src/lib.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-processor/tests/security.rs
  • magicblock-aperture/tests/mocked.rs
  • magicblock-config/src/tests.rs
  • test-integration/test-ledger-restore/src/lib.rs
  • magicblock-processor/tests/fees.rs
📚 Learning: 2025-11-07T14:20:31.457Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs:457-495
Timestamp: 2025-11-07T14:20:31.457Z
Learning: In magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs, the unsubscribe closure returned by PubSubConnection::account_subscribe(...) resolves to () (unit), not a Result. Downstream code should not attempt to inspect an unsubscribe result and can optionally wrap it in a timeout to guard against hangs.

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • magicblock-chainlink/src/chainlink/fetch_cloner.rs
  • magicblock-aperture/src/server/websocket/connection.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-chainlink/src/submux/mod.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-config/src/types/network.rs
📚 Learning: 2025-11-18T08:47:39.702Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: magicblock-chainlink/tests/04_redeleg_other_separate_slots.rs:158-165
Timestamp: 2025-11-18T08:47:39.702Z
Learning: In magicblock-chainlink tests involving compressed accounts, `set_remote_slot()` sets the slot of the `AccountSharedData`, while `compressed_account_shared_with_owner_and_slot()` sets the slot of the delegation record. These are two different fields and both calls are necessary.

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/mod.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/mod.rs
  • magicblock-aperture/src/requests/http/mocked.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-metrics/src/metrics/mod.rs
  • magicblock-chainlink/src/submux/mod.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-config/src/types/network.rs
  • Cargo.toml
📚 Learning: 2025-11-24T08:45:11.164Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 675
File: Cargo.toml:145-145
Timestamp: 2025-11-24T08:45:11.164Z
Learning: The reqwest dependency version 0.11 is intentionally used in the magicblock-validator project to maintain compatibility with the Solana client dependencies.

Applied to files:

  • magicblock-aperture/Cargo.toml
  • Cargo.toml
📚 Learning: 2025-12-15T20:32:57.435Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 746
File: magicblock-config/src/tests.rs:680-703
Timestamp: 2025-12-15T20:32:57.435Z
Learning: In the magicblock-validator repository, gRPC remotes do not support URL aliases (mainnet, devnet, local) like RPC and WebSocket remotes do. The resolve_url function passes gRPC URLs through as-is without alias resolution.

Applied to files:

  • config.example.toml
  • test-integration/test-config/src/lib.rs
  • magicblock-config/src/lib.rs
  • magicblock-config/src/types/network.rs
  • test-integration/test-tools/src/toml_to_args.rs
📚 Learning: 2025-12-17T12:46:36.207Z
Learnt from: GabrielePicco
Repo: magicblock-labs/magicblock-validator PR: 738
File: magicblock-chainlink/src/chainlink/fetch_cloner.rs:1109-1196
Timestamp: 2025-12-17T12:46:36.207Z
Learning: In magicblock-chainlink/src/chainlink/fetch_cloner.rs, eATA account subscriptions are intentionally NOT cancelled even when the eATA doesn't exist or delegation conversion fails. The subscriptions are kept active to watch for future creation or delegation of eATA accounts (per maintainer GabrielePicco).

Applied to files:

  • magicblock-chainlink/src/chainlink/fetch_cloner.rs
  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-chainlink/src/submux/mod.rs
📚 Learning: 2025-11-13T09:38:43.804Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:64-102
Timestamp: 2025-11-13T09:38:43.804Z
Learning: In magicblock-processor's TransactionScheduler (scheduler/mod.rs line 59), the executor count is clamped to MAX_SVM_EXECUTORS (63) at initialization time, and executor IDs are assigned sequentially from 0 to count-1. This architectural guarantee ensures that executor IDs used in the bitmask-based AccountLock (scheduler/locks.rs) will always be within valid bounds for bit shifting operations, making runtime bounds checks unnecessary.

Applied to files:

  • magicblock-processor/src/executor/processing.rs
  • magicblock-processor/src/executor/mod.rs
  • magicblock-processor/tests/scheduling.rs
  • magicblock-processor/src/scheduler/tests.rs
  • magicblock-processor/src/scheduler/mod.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-processor/src/scheduler/locks.rs
  • magicblock-api/src/magic_validator.rs
  • test-kit/src/lib.rs
  • magicblock-processor/src/scheduler/coordinator.rs
📚 Learning: 2025-11-04T10:53:50.922Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:110-122
Timestamp: 2025-11-04T10:53:50.922Z
Learning: In magicblock-processor, the TransactionScheduler runs in a single, dedicated thread and will always remain single-threaded. The `next_transaction_id()` function in scheduler/locks.rs uses `unsafe static mut` which is safe given this architectural guarantee.

Applied to files:

  • magicblock-processor/src/executor/mod.rs
  • magicblock-processor/tests/scheduling.rs
  • magicblock-processor/src/scheduler/tests.rs
  • magicblock-processor/src/scheduler/mod.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-processor/src/scheduler/locks.rs
  • magicblock-api/src/magic_validator.rs
  • test-kit/src/lib.rs
  • magicblock-processor/src/scheduler/coordinator.rs
📚 Learning: 2025-11-07T13:09:52.253Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: test-kit/src/lib.rs:275-0
Timestamp: 2025-11-07T13:09:52.253Z
Learning: In test-kit, the transaction scheduler in ExecutionTestEnv is not expected to shut down during tests. Therefore, using `.unwrap()` in test helper methods like `schedule_transaction` is acceptable and will not cause issues in the test environment.

Applied to files:

  • magicblock-processor/src/executor/mod.rs
  • magicblock-processor/tests/scheduling.rs
  • magicblock-processor/src/scheduler/tests.rs
  • magicblock-processor/src/scheduler/mod.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-processor/tests/security.rs
  • magicblock-api/src/magic_validator.rs
  • test-kit/src/lib.rs
  • magicblock-processor/tests/fees.rs
  • magicblock-processor/src/scheduler/coordinator.rs
📚 Learning: 2025-12-01T16:02:05.367Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 703
File: magicblock-chainlink/src/submux/mod.rs:652-654
Timestamp: 2025-12-01T16:02:05.367Z
Learning: In magicblock-chainlink/src/submux/mod.rs, the subscribe_program method intentionally adds program_id to program_subs before attempting the subscription. This ensures that even if the initial subscription fails or only partially succeeds across clients, the reconnection logic will retry the subscription. This is a deliberate design pattern for resilience in the multi-client architecture and should not be "fixed" to remove entries on failure.

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-metrics/src/metrics/mod.rs
  • magicblock-chainlink/src/submux/mod.rs
  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-10-26T16:53:29.820Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 587
File: magicblock-chainlink/src/remote_account_provider/mod.rs:134-0
Timestamp: 2025-10-26T16:53:29.820Z
Learning: In magicblock-chainlink/src/remote_account_provider/mod.rs, the `Endpoint::separate_pubsub_url_and_api_key()` method uses `split_once("?api-key=")` because the api-key parameter is always the only query parameter right after `?`. No additional query parameter parsing is needed for this use case.

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-07T13:20:13.793Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/coordinator.rs:227-238
Timestamp: 2025-11-07T13:20:13.793Z
Learning: In magicblock-processor's ExecutionCoordinator (scheduler/coordinator.rs), the `account_contention` HashMap intentionally does not call `shrink_to_fit()`. Maintaining slack capacity is beneficial for performance by avoiding frequent reallocations during high transaction throughput. As long as empty entries are removed from the map (which `clear_account_contention` does), the capacity overhead is acceptable.

Applied to files:

  • magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs
  • magicblock-processor/src/scheduler/tests.rs
  • magicblock-processor/src/scheduler/mod.rs
  • magicblock-processor/src/scheduler/locks.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-processor/src/scheduler/coordinator.rs
📚 Learning: 2025-10-14T09:56:14.047Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 564
File: test-integration/programs/flexi-counter/src/processor/call_handler.rs:122-125
Timestamp: 2025-10-14T09:56:14.047Z
Learning: The file test-integration/programs/flexi-counter/src/processor/call_handler.rs contains a test smart contract used for integration testing, not production code.

Applied to files:

  • magicblock-processor/tests/scheduling.rs
  • magicblock-processor/tests/security.rs
  • magicblock-aperture/tests/node.rs
  • test-integration/test-ledger-restore/src/lib.rs
  • magicblock-processor/tests/fees.rs
📚 Learning: 2025-11-12T09:46:27.553Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.

Applied to files:

  • magicblock-processor/tests/scheduling.rs
  • magicblock-processor/src/scheduler/tests.rs
  • magicblock-processor/src/scheduler/mod.rs
  • magicblock-task-scheduler/src/service.rs
  • test-integration/test-task-scheduler/src/lib.rs
  • magicblock-api/src/magic_validator.rs
  • Cargo.toml
📚 Learning: 2025-11-19T12:55:48.931Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: test-integration/test-tools/src/validator.rs:193-197
Timestamp: 2025-11-19T12:55:48.931Z
Learning: In the magicblock-validator codebase, when constructing arguments for the light CLI test validator in start_light_validator_with_config (test-integration/test-tools/src/validator.rs), the shlex::split approach is necessary because the light CLI does not handle whitespaces properly in validator arguments. The string concatenation + shlex parsing pattern should not be refactored to direct argument construction in this specific case.

Applied to files:

  • test-integration/test-config/tests/auto_airdrop_feepayer.rs
  • magicblock-config/src/config/cli.rs
  • Cargo.toml
📚 Learning: 2025-11-20T08:57:07.217Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 650
File: magicblock-chainlink/src/submux/subscription_task.rs:13-99
Timestamp: 2025-11-20T08:57:07.217Z
Learning: In the magicblock-validator repository, avoid posting review comments that merely confirm code is correct or matches intended behavior without providing actionable feedback, suggestions for improvement, or identifying potential issues. Such confirmatory comments are considered unhelpful noise by the maintainers.

Applied to files:

  • docs/CONTRIBUTING.md
  • magicblock-task-scheduler/src/service.rs
  • Cargo.toml
📚 Learning: 2025-11-21T11:03:26.756Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 664
File: magicblock-chainlink/src/testing/mod.rs:342-370
Timestamp: 2025-11-21T11:03:26.756Z
Learning: In the magicblock-validator codebase, avoid leaving review comments that merely acknowledge code is correct or well-structured when there is no actionable suggestion, improvement, or issue to flag. Only comment when there is something specific to recommend, fix, or clarify.

Applied to files:

  • docs/CONTRIBUTING.md
  • magicblock-task-scheduler/src/service.rs
  • Cargo.toml
📚 Learning: 2025-10-21T13:06:38.900Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/http/get_program_accounts.rs:17-25
Timestamp: 2025-10-21T13:06:38.900Z
Learning: The magicblock validator does not support ledger forking, so commitment-based state queries (processed/confirmed/finalized) are not applicable. RPC methods can safely ignore commitment and minContextSlot parameters from Solana RPC config objects.

Applied to files:

  • docs/CONTRIBUTING.md
  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-04T10:48:00.070Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/mod.rs:217-219
Timestamp: 2025-11-04T10:48:00.070Z
Learning: In magicblock-validator, the codebase uses a pattern where types containing non-Send/non-Sync fields (like Rc<RefCell<...>>) are marked with unsafe impl Send when they are guaranteed to be confined to a single thread through careful API design and thread spawning patterns.

Applied to files:

  • test-integration/test-config/src/lib.rs
  • test-kit/src/lib.rs
📚 Learning: 2025-10-28T13:15:42.706Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 596
File: magicblock-processor/src/scheduler.rs:1-1
Timestamp: 2025-10-28T13:15:42.706Z
Learning: In magicblock-processor, transaction indexes were always set to 0 even before the changes in PR #596. The proper transaction indexing within slots will be addressed during the planned ledger rewrite.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.

Applied to files:

  • magicblock-task-scheduler/src/service.rs
📚 Learning: 2025-10-21T10:34:59.140Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-accounts-db/src/lib.rs:63-72
Timestamp: 2025-10-21T10:34:59.140Z
Learning: In magicblock-validator, the AccountsDb "stop-the-world" synchronizer is managed at the processor/executor level, not at the AccountsDb API level. Transaction executors in magicblock-processor hold a read lock (sync.read()) for the duration of each slot and release it only at slot boundaries, ensuring all account writes happen under the read lock. Snapshot operations acquire a write lock, blocking until all executors release their read locks. This pattern ensures mutual exclusion between writes and snapshots without requiring read guards in AccountsDb write APIs.

Applied to files:

  • magicblock-processor/src/scheduler/locks.rs
  • magicblock-processor/src/scheduler/coordinator.rs
📚 Learning: 2025-10-26T16:54:39.084Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 587
File: test-manual/Cargo.toml:0-0
Timestamp: 2025-10-26T16:54:39.084Z
Learning: In the magicblock-validator repository, use git branch references (not commit hashes or tags) for the helius-laserstream dependency to allow automatic updates when the branch is pushed to.

Applied to files:

  • magicblock-api/src/magic_validator.rs
🧬 Code graph analysis (23)
magicblock-aperture/src/requests/http/request_airdrop.rs (1)
magicblock-aperture/src/requests/mod.rs (1)
  • params (27-31)
magicblock-table-mania/src/manager.rs (1)
magicblock-committor-service/src/intent_execution_manager/intent_execution_engine.rs (1)
  • rand (666-666)
magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs (3)
magicblock-metrics/src/metrics/mod.rs (1)
  • inc_program_subscription_account_updates (641-645)
magicblock-table-mania/src/lookup_table_rc.rs (1)
  • contains_key (308-311)
magicblock-chainlink/src/remote_account_provider/config.rs (1)
  • program_subs (74-76)
magicblock-processor/tests/scheduling.rs (3)
test-kit/src/lib.rs (4)
  • new_with_config (99-162)
  • new (87-89)
  • get_transaction (210-218)
  • get_account (311-321)
magicblock-processor/src/executor/mod.rs (1)
  • new (73-118)
magicblock-processor/src/scheduler/mod.rs (1)
  • new (58-91)
test-integration/test-config/tests/auto_airdrop_feepayer.rs (2)
magicblock-config/src/types/network.rs (2)
  • from_str (63-81)
  • from_str (133-142)
test-integration/test-tools/src/integration_test_context.rs (2)
  • url_chain (1151-1153)
  • ws_url_chain (1154-1156)
magicblock-processor/src/scheduler/tests.rs (1)
magicblock-processor/src/scheduler/coordinator.rs (5)
  • new (33-38)
  • new (60-69)
  • try_acquire_locks (148-221)
  • get_ready_executor (116-118)
  • next_blocked_transaction (136-141)
magicblock-processor/src/scheduler/mod.rs (2)
magicblock-processor/src/executor/mod.rs (4)
  • new (73-118)
  • spawn (142-153)
  • run (167-207)
  • transition_to_new_slot (211-216)
magicblock-processor/src/scheduler/coordinator.rs (3)
  • new (33-38)
  • new (60-69)
  • is_ready (110-112)
test-integration/test-config/src/lib.rs (2)
magicblock-config/src/types/network.rs (2)
  • from_str (63-81)
  • from_str (133-142)
test-integration/test-tools/src/integration_test_context.rs (2)
  • url_chain (1151-1153)
  • ws_url_chain (1154-1156)
magicblock-config/src/lib.rs (1)
magicblock-config/src/types/network.rs (1)
  • websocket (42-44)
magicblock-task-scheduler/src/service.rs (1)
magicblock-core/src/link.rs (1)
  • link (60-89)
magicblock-processor/tests/security.rs (1)
test-kit/src/lib.rs (3)
  • new_with_config (99-162)
  • new (87-89)
  • get_payer (323-329)
magicblock-metrics/src/metrics/types.rs (3)
magicblock-committor-service/src/intent_executor/error.rs (2)
  • value (120-132)
  • value (247-255)
magicblock-committor-service/src/intent_executor/mod.rs (1)
  • value (75-83)
magicblock-committor-service/src/types.rs (1)
  • value (23-29)
test-integration/test-task-scheduler/src/lib.rs (2)
magicblock-config/src/types/network.rs (2)
  • from_str (63-81)
  • from_str (133-142)
test-integration/test-tools/src/integration_test_context.rs (2)
  • url_chain (1151-1153)
  • ws_url_chain (1154-1156)
magicblock-aperture/tests/mocked.rs (1)
test-kit/src/lib.rs (1)
  • get_payer (323-329)
magicblock-api/src/magic_validator.rs (2)
magicblock-api/src/domain_registry_manager.rs (1)
  • new (26-33)
magicblock-config/src/lib.rs (1)
  • rpc_url (154-159)
magicblock-config/src/types/network.rs (1)
test-integration/test-tools/src/toml_to_args.rs (1)
  • url (27-44)
test-integration/test-tools/src/toml_to_args.rs (1)
magicblock-config/src/types/network.rs (2)
  • from_str (63-81)
  • from_str (133-142)
magicblock-aperture/tests/node.rs (1)
test-kit/src/lib.rs (1)
  • get_payer (323-329)
test-kit/src/lib.rs (1)
test-integration/test-schedule-intent/tests/test_schedule_intents.rs (5)
  • payers (172-172)
  • payers (194-194)
  • payers (228-228)
  • payers (244-244)
  • payers (271-271)
magicblock-config/src/tests.rs (1)
magicblock-config/src/types/network.rs (1)
  • url_str (86-92)
test-integration/test-ledger-restore/src/lib.rs (2)
magicblock-config/src/types/network.rs (2)
  • from_str (63-81)
  • from_str (133-142)
test-integration/test-tools/src/integration_test_context.rs (2)
  • url_chain (1151-1153)
  • ws_url_chain (1154-1156)
magicblock-processor/tests/fees.rs (1)
test-kit/src/lib.rs (2)
  • get_payer (323-329)
  • new_with_config (99-162)
magicblock-processor/src/scheduler/coordinator.rs (1)
magicblock-processor/src/scheduler/locks.rs (1)
  • next_transaction_id (106-117)
🪛 LanguageTool
docs/GOVERNANCE.md

[uncategorized] ~48-~48: The official name of this software platform is spelled with a capital “H”.
Context: .... ### The Code Ownership Manifest The .github/CODEOWNERS file serves as the definiti...

(GITHUB)


[style] ~95-~95: This phrase is redundant. Consider writing “consult”.
Context: ... significant changes, the assignee must consult with the CO of the affected crate(s) to alig...

(CONSULT_WITH)

🪛 markdownlint-cli2 (0.18.1)
docs/GOVERNANCE.md

7-7: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

@Dodecahedr0x Dodecahedr0x force-pushed the dode/schedule-with-rpc branch from 97b3e25 to 03c459c Compare December 23, 2025 16:33
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
magicblock-config/src/types/network.rs (1)

60-82: Consider expanding the SAFETY comment for clarity.

The unsafe byte manipulation is correct and justified. However, the SAFETY comment could be more explicit about why the operation is safe:

  1. The prefix check confirms exactly 4 ASCII bytes ("grpc")
  2. The replacement is also exactly 4 ASCII bytes ("http")
  3. No Unicode boundaries are violated since both are valid ASCII
  4. The length remains unchanged

This would help future maintainers quickly verify the safety invariants without deep analysis.

🔎 Enhanced SAFETY comment
-        // SAFETY:
-        // We made sure that "grpc" is the prefix and we are not violating Unicode invariants
+        // SAFETY: This byte-level replacement is safe because:
+        // 1. We verified the string starts with exactly "grpc" (4 ASCII bytes)
+        // 2. We're replacing with "http" (also exactly 4 ASCII bytes)
+        // 3. Both strings are valid ASCII, so no Unicode boundaries are violated
+        // 4. The string length remains unchanged
         unsafe { s.as_bytes_mut()[0..4].copy_from_slice(b"http") };
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 97b3e25 and 03c459c.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • test-integration/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (8)
  • magicblock-api/src/magic_validator.rs
  • magicblock-config/src/types/network.rs
  • magicblock-task-scheduler/Cargo.toml
  • magicblock-task-scheduler/src/db.rs
  • magicblock-task-scheduler/src/errors.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-task-scheduler/tests/service.rs
  • test-integration/programs/schedulecommit/src/api.rs
💤 Files with no reviewable changes (1)
  • magicblock-task-scheduler/tests/service.rs
🚧 Files skipped from review as they are similar to previous changes (3)
  • test-integration/programs/schedulecommit/src/api.rs
  • magicblock-task-scheduler/src/service.rs
  • magicblock-task-scheduler/Cargo.toml
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.
📚 Learning: 2025-11-12T09:46:27.553Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 614
File: magicblock-task-scheduler/src/db.rs:26-0
Timestamp: 2025-11-12T09:46:27.553Z
Learning: In magicblock-task-scheduler, task parameter validation (including ensuring iterations > 0 and enforcing minimum execution intervals) is performed in the Magic program (on-chain) before ScheduleTaskRequest instances reach the scheduler service. The From<&ScheduleTaskRequest> conversion in db.rs does not need additional validation because inputs are already validated at the program level.

Applied to files:

  • magicblock-task-scheduler/src/errors.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-task-scheduler/src/db.rs
📚 Learning: 2025-11-21T10:22:07.520Z
Learnt from: taco-paco
Repo: magicblock-labs/magicblock-validator PR: 661
File: magicblock-committor-service/src/intent_executor/single_stage_executor.rs:20-28
Timestamp: 2025-11-21T10:22:07.520Z
Learning: In magicblock-committor-service's SingleStageExecutor and TwoStageExecutor (single_stage_executor.rs and two_stage_executor.rs), the fields transaction_strategy, junk, and patched_errors are intentionally public because these executors are designed to be used independently outside of the IntentExecutor scope, and callers need access to these execution reports for cleanup and error handling.

Applied to files:

  • magicblock-task-scheduler/src/errors.rs
📚 Learning: 2025-11-20T17:25:23.444Z
Learnt from: JMirval
Repo: magicblock-labs/magicblock-validator PR: 656
File: programs/guinea/src/lib.rs:33-33
Timestamp: 2025-11-20T17:25:23.444Z
Learning: In the magicblock-validator codebase, task IDs (task_id) are i64 values that can be negative. The task scheduler is designed to handle any i64 value including negative task IDs. Task IDs are randomly generated using rand::random() which produces values across the full i64 range. No validation is needed to restrict task IDs to positive values.

Applied to files:

  • magicblock-task-scheduler/src/errors.rs
  • magicblock-api/src/magic_validator.rs
  • magicblock-task-scheduler/src/db.rs
📚 Learning: 2025-10-21T14:00:54.642Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/websocket/account_subscribe.rs:18-27
Timestamp: 2025-10-21T14:00:54.642Z
Learning: In magicblock-aperture account_subscribe handler (src/requests/websocket/account_subscribe.rs), the RpcAccountInfoConfig fields data_slice, commitment, and min_context_slot are currently ignored—only encoding is applied. This is tracked as technical debt in issue #579: https://github.com/magicblock-labs/magicblock-validator/issues/579

Applied to files:

  • magicblock-api/src/magic_validator.rs
  • magicblock-config/src/types/network.rs
📚 Learning: 2025-11-19T12:55:48.931Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: test-integration/test-tools/src/validator.rs:193-197
Timestamp: 2025-11-19T12:55:48.931Z
Learning: In the magicblock-validator codebase, when constructing arguments for the light CLI test validator in start_light_validator_with_config (test-integration/test-tools/src/validator.rs), the shlex::split approach is necessary because the light CLI does not handle whitespaces properly in validator arguments. The string concatenation + shlex parsing pattern should not be refactored to direct argument construction in this specific case.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-04T10:53:50.922Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:110-122
Timestamp: 2025-11-04T10:53:50.922Z
Learning: In magicblock-processor, the TransactionScheduler runs in a single, dedicated thread and will always remain single-threaded. The `next_transaction_id()` function in scheduler/locks.rs uses `unsafe static mut` which is safe given this architectural guarantee.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-10-21T13:06:38.900Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 578
File: magicblock-aperture/src/requests/http/get_program_accounts.rs:17-25
Timestamp: 2025-10-21T13:06:38.900Z
Learning: The magicblock validator does not support ledger forking, so commitment-based state queries (processed/confirmed/finalized) are not applicable. RPC methods can safely ignore commitment and minContextSlot parameters from Solana RPC config objects.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-13T09:38:43.804Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 589
File: magicblock-processor/src/scheduler/locks.rs:64-102
Timestamp: 2025-11-13T09:38:43.804Z
Learning: In magicblock-processor's TransactionScheduler (scheduler/mod.rs line 59), the executor count is clamped to MAX_SVM_EXECUTORS (63) at initialization time, and executor IDs are assigned sequentially from 0 to count-1. This architectural guarantee ensures that executor IDs used in the bitmask-based AccountLock (scheduler/locks.rs) will always be within valid bounds for bit shifting operations, making runtime bounds checks unnecessary.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-11-24T14:21:00.996Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: Cargo.toml:58-58
Timestamp: 2025-11-24T14:21:00.996Z
Learning: In the magicblock-validator codebase, magicblock-api/Cargo.toml intentionally uses borsh = "1.5.3" (instead of the workspace version 0.10.4) because it needs to deserialize types from the magic-domain-program external dependency, which requires borsh 1.5.x compatibility. This is an intentional exception for interoperability with the magic domain program.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-10-28T13:15:42.706Z
Learnt from: bmuddha
Repo: magicblock-labs/magicblock-validator PR: 596
File: magicblock-processor/src/scheduler.rs:1-1
Timestamp: 2025-10-28T13:15:42.706Z
Learning: In magicblock-processor, transaction indexes were always set to 0 even before the changes in PR #596. The proper transaction indexing within slots will be addressed during the planned ledger rewrite.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-10-26T16:54:39.084Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 587
File: test-manual/Cargo.toml:0-0
Timestamp: 2025-10-26T16:54:39.084Z
Learning: In the magicblock-validator repository, use git branch references (not commit hashes or tags) for the helius-laserstream dependency to allow automatic updates when the branch is pushed to.

Applied to files:

  • magicblock-api/src/magic_validator.rs
📚 Learning: 2025-12-15T20:32:57.435Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 746
File: magicblock-config/src/tests.rs:680-703
Timestamp: 2025-12-15T20:32:57.435Z
Learning: In the magicblock-validator repository, gRPC remotes do not support URL aliases (mainnet, devnet, local) like RPC and WebSocket remotes do. The resolve_url function passes gRPC URLs through as-is without alias resolution.

Applied to files:

  • magicblock-config/src/types/network.rs
📚 Learning: 2025-12-03T09:36:01.527Z
Learnt from: Dodecahedr0x
Repo: magicblock-labs/magicblock-validator PR: 639
File: magicblock-chainlink/src/remote_account_provider/mod.rs:1350-1353
Timestamp: 2025-12-03T09:36:01.527Z
Learning: Repo: magicblock-labs/magicblock-validator
File: magicblock-chainlink/src/remote_account_provider/mod.rs
Context: consolidate_fetched_remote_accounts
Learning: For unexpected result counts (>2), the project prefers logging an error and returning an empty Vec over panicking; acceptable during development per maintainer (Dodecahedr0x).

Applied to files:

  • magicblock-config/src/types/network.rs
📚 Learning: 2025-11-07T14:20:31.457Z
Learnt from: thlorenz
Repo: magicblock-labs/magicblock-validator PR: 621
File: magicblock-chainlink/src/remote_account_provider/chain_pubsub_actor.rs:457-495
Timestamp: 2025-11-07T14:20:31.457Z
Learning: In magicblock-chainlink/src/remote_account_provider/chain_pubsub_client.rs, the unsubscribe closure returned by PubSubConnection::account_subscribe(...) resolves to () (unit), not a Result. Downstream code should not attempt to inspect an unsubscribe result and can optionally wrap it in a timeout to guard against hangs.

Applied to files:

  • magicblock-config/src/types/network.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build Project
  • GitHub Check: run_make_ci_lint
  • GitHub Check: run_make_ci_test
🔇 Additional comments (12)
magicblock-config/src/types/network.rs (3)

23-45: LGTM! The bind address normalization correctly fixes the previous issue.

The as_connect_addr() method properly handles the conversion of unspecified bind addresses (0.0.0.0/::) to localhost for client connections, preventing failures when BindAddress is used to construct client URLs. Both IPv4 and IPv6 cases are covered, and the port is correctly preserved.


95-112: LGTM! WebSocket derivation logic is correct.

The method properly:

  • Returns existing WebSocket remotes as-is
  • Returns None for gRPC (which doesn't support WebSocket conversion)
  • Converts HTTP/HTTPS schemes to WS/WSS
  • Increments the port by 1 following Solana's convention
  • Handles missing ports gracefully

The ignored Results from set_scheme() and set_port() are acceptable since these operations cannot meaningfully fail in this context.


114-143: LGTM! AliasedUrl implementation is clean and correct.

The alias resolution correctly maps shortcut names (mainnet, devnet, testnet, localhost, dev) to their full URLs from constants, with a fallback to custom URLs. The Deref trait provides ergonomic access to the underlying Url, and the implementation is straightforward.

magicblock-api/src/magic_validator.rs (1)

295-305: LGTM!

The refactoring to pass config.listen.http() instead of dispatch.transaction_scheduler.clone() correctly aligns with the PR objective to use RPC client for transaction submission. The additional parameters (ledger.latest_block().clone() and token.clone()) support the new RPC-based implementation.

magicblock-task-scheduler/src/errors.rs (1)

5-21: LGTM!

The error type simplification aligns well with the migration to RPC-based transaction submission:

  • Boxing the Rpc error variant is a good practice to keep the enum size manageable
  • Removal of task-specific error variants (e.g., TaskNotFound, TaskContextNotFound) shifts error handling to the caller level via Option types, which is cleaner
  • Elimination of Pubsub and Transaction variants is consistent with replacing the transaction executor with an RPC client
magicblock-task-scheduler/src/db.rs (7)

10-10: LGTM!

The migration from TaskSchedulerError to TaskSchedulerResult as the import aligns with the broader error handling refactoring across the task scheduler module.


68-109: LGTM!

The addition of created_at and updated_at timestamp columns to the tasks table provides useful audit capabilities for tracking task lifecycle events. The consistent use of TaskSchedulerResult<Self> as the return type aligns with the module-wide error handling migration.


111-133: LGTM!

The timestamp tracking in insert_task using INSERT OR REPLACE correctly initializes both created_at and updated_at to the current time. The consistent use of TaskSchedulerResult<()> aligns with the error handling refactoring.


135-152: LGTM!

The update_task_after_execution method correctly updates the updated_at timestamp alongside the execution-related fields. The consistent use of TaskSchedulerResult<()> aligns with the error handling refactoring.


154-199: LGTM!

The error logging and task management methods (insert_failed_scheduling, insert_failed_task, unschedule_task, remove_task) consistently use TaskSchedulerResult<()>, maintaining alignment with the error handling refactoring.


201-239: LGTM!

The get_task method correctly returns TaskSchedulerResult<Option<DbTask>>, allowing callers to distinguish between task-not-found (None) and database errors, which is cleaner than the previous error variant approach.


241-335: LGTM!

The query methods (get_tasks, get_task_ids, get_failed_schedulings, get_failed_tasks) consistently use TaskSchedulerResult<Vec<T>> as return types, completing the migration to the new error handling approach across the entire database interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: task scheduler not using chainlink prevents cloning missing accounts

5 participants